home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cocktail / cg.lha / cg / m2c / Semantics.c < prev    next >
C/C++ Source or Header  |  1992-11-24  |  90KB  |  3,092 lines

  1. #include "SYSTEM_.h"
  2.  
  3. #ifndef DEFINITION_System
  4. #include "System.h"
  5. #endif
  6.  
  7. #ifndef DEFINITION_IO
  8. #include "IO.h"
  9. #endif
  10.  
  11. #ifndef DEFINITION_Tree
  12. #include "Tree.h"
  13. #endif
  14.  
  15. #ifndef DEFINITION_General
  16. #include "General.h"
  17. #endif
  18.  
  19. #ifndef DEFINITION_IO
  20. #include "IO.h"
  21. #endif
  22.  
  23. #ifndef DEFINITION_DynArray
  24. #include "DynArray.h"
  25. #endif
  26.  
  27. #ifndef DEFINITION_StringMem
  28. #include "StringMem.h"
  29. #endif
  30.  
  31. #ifndef DEFINITION_Strings
  32. #include "Strings.h"
  33. #endif
  34.  
  35. #ifndef DEFINITION_Idents
  36. #include "Idents.h"
  37. #endif
  38.  
  39. #ifndef DEFINITION_Texts
  40. #include "Texts.h"
  41. #endif
  42.  
  43. #ifndef DEFINITION_Sets
  44. #include "Sets.h"
  45. #endif
  46.  
  47. #ifndef DEFINITION_Relations
  48. #include "Relations.h"
  49. #endif
  50.  
  51. #ifndef DEFINITION_Positions
  52. #include "Positions.h"
  53. #endif
  54.  
  55. #ifndef DEFINITION_Tree
  56. #include "Tree.h"
  57. #endif
  58.  
  59. #ifndef DEFINITION_Relations
  60. #include "Relations.h"
  61. #endif
  62.  
  63. #ifndef DEFINITION_StringMem
  64. #include "StringMem.h"
  65. #endif
  66.  
  67. #ifndef DEFINITION_Errors
  68. #include "Errors.h"
  69. #endif
  70.  
  71. #ifndef DEFINITION_Semantics
  72. #include "Semantics.h"
  73. #endif
  74.  
  75. SHORTCARD Semantics_TypeCount;
  76. IO_tFile Semantics_yyf;
  77. PROC Semantics_Exit;
  78.  
  79. #define AssignmentWithIncorrectLeftHandSide    10
  80. #define CopyRuleWithIncorrectLeftHandSide    11
  81. #define BlockWithIncorrectLeftHandSide    12
  82. #define CheckWithoutStatement    13
  83. #define InheritedUseOfSynthesizedAttribute    14
  84. #define AttributeMultipleComputed    15
  85. #define AttributeNotDeclared    16
  86. #define SelectorNotDeclared    17
  87. #define SynthesizedUseOfInheritedAttribute    18
  88. #define CopyRuleInsertionsInherited    19
  89. #define CopyRuleInsertionsSynthesized    20
  90. #define CopyRuleInsertionsThreaded    21
  91. #define ModuleNotDeclared    22
  92. #define TerminalCodeMultipleUsed    23
  93. #define NodeTypeNotDeclared    24
  94. #define OnlyOneReverseInNodeType    25
  95. #define NodeTypeMultipleDeclared    26
  96. #define VariantSelectorMultipleDeclared    27
  97. #define PrecedenceNotDeclared    28
  98. #define SelectorMultipleDeclared    29
  99. #define PrecedenceMultipleDeclared    30
  100. #define AbstractTypeRequired    31
  101. #define ChildRequired    32
  102. #define AttributeNeverSet    33
  103. #define AttributeNeverUsed    34
  104. #define InputAttributeIsSet    35
  105. #define AttributeSynthesizedAsWellAsInherited    36
  106. #define NodeTypeNotUsed    37
  107. #define InheritedAttributesOnlyInBaseClasses    38
  108. #define AttributeComputationMissing    39
  109. #define CycleInLocalDependenciesDP    40
  110. static INTEGER CopyInherited, CopySynthesized, CopyThreaded, ChildCount, AttributeCount, ActionCount;
  111. static INTEGER ItemCount, ChecksCount, ReverseCount;
  112. static Idents_tIdent iNull, Ident;
  113. static Sets_tSet ClassNames, SelectorNames, VariantNames, PrecNames, CodesUsed, Results, Arguments, Cyclics;
  114. static SHORTCARD MaxInstCount, TokenCode, DummyIndex, i, j, k;
  115. static LONGINT InstanceSize;
  116. static BOOLEAN IsAbstract, Success;
  117. static Tree_tTree Module, Node, Attribute, Child, TheAction, TheClass, Class;
  118. static Strings_tString String, String2;
  119. static BITSET ActProperties;
  120. static BOOLEAN LookUp ARGS((Idents_tIdent i, Tree_tTree t));
  121. static Tree_tTree ProcessIgnore2 ARGS((Tree_tTree t));
  122. static void CompBaseClass ARGS((Tree_tTree t, Tree_tTree b));
  123. static void CompParsIndex ARGS((Tree_tTree t, SHORTCARD *Index));
  124. static void CompIndex ARGS((Tree_tTree t, SHORTCARD In, SHORTCARD *Out));
  125. static void CompInstance ARGS((Tree_tTree t, SHORTCARD In, SHORTCARD *Out));
  126. static void CompBitCount ARGS((Tree_tTree t, SHORTCARD In, SHORTCARD *Out));
  127. static void CompBitOffset ARGS((Tree_tTree t, SHORTCARD In, SHORTCARD *Out));
  128. static void InitInstance ARGS((Tree_tTree t, SHORTCARD Offset, Tree_tInstancePtr InstancePtr));
  129. static void InitInstance1 ARGS((Tree_tTree t, Tree_tTree selector, SHORTCARD Offset, Tree_tInstancePtr InstancePtr));
  130. static Relations_tRelation relation;
  131. static INTEGER result;
  132. static void EnterDependency ARGS((CARDINAL argument));
  133. static BOOLEAN MultipleInheritedActions;
  134. static void CompDP1 ARGS((Tree_tTree t, Sets_tSet *Set, INTEGER Usage, BOOLEAN NonBase, BOOLEAN Check));
  135. static BOOLEAN IsCode ARGS((Tree_tTree t));
  136. static Tree_tTree CopyTree ARGS((Tree_tTree t));
  137. static void ExpandMultiple ARGS((Tree_tTree Class));
  138. static void AppendAttr ARGS((Tree_tTree *Attributes, Tree_tTree Attribute));
  139. static void yyAbort ARGS((CHAR yyFunction[], LONGCARD ));
  140. static BOOLEAN yyIsEqual ARGS((BYTE yya[], LONGCARD , BYTE yyb[], LONGCARD ));
  141. struct S_3 {
  142.     union {
  143.         char dummy;
  144.     } U_1;
  145. };
  146. static void StampItems ARGS((Tree_tTree t));
  147. struct S_4 {
  148.     union {
  149.         char dummy;
  150.     } U_1;
  151. };
  152. static void ExpandProps ARGS((Tree_tTree t));
  153. struct S_5 {
  154.     union {
  155.         char dummy;
  156.     } U_1;
  157. };
  158. static void CheckSelect ARGS((Tree_tTree t));
  159. struct S_6 {
  160.     union {
  161.         char dummy;
  162.     } U_1;
  163. };
  164. static void ProcessIgnore ARGS((Tree_tTree t));
  165. struct S_7 {
  166.     union {
  167.         char dummy;
  168.     } U_1;
  169. };
  170. static void ExpandModules ARGS((Tree_tTree t));
  171. struct S_8 {
  172.     union {
  173.         char dummy;
  174.     } U_1;
  175. };
  176. static void ExpandChecks ARGS((Tree_tTree t));
  177. struct S_9 {
  178.     union {
  179.         char dummy;
  180.     } U_1;
  181. };
  182. static void ExpandMultiple2 ARGS((Tree_tTree t));
  183. struct S_10 {
  184.     union {
  185.         char dummy;
  186.     } U_1;
  187. };
  188. static void CountClasses ARGS((Tree_tTree t));
  189. struct S_11 {
  190.     union {
  191.         char dummy;
  192.     } U_1;
  193. };
  194. static void CompReachable ARGS((Tree_tTree t));
  195. struct S_12 {
  196.     union {
  197.         char dummy;
  198.     } U_1;
  199. };
  200. static void CodeTerminals ARGS((Tree_tTree t));
  201. struct S_13 {
  202.     union {
  203.         char dummy;
  204.     } U_1;
  205. };
  206. static void CheckReverse ARGS((Tree_tTree t));
  207. struct S_14 {
  208.     union {
  209.         char dummy;
  210.     } U_1;
  211. };
  212. static void CheckNames ARGS((Tree_tTree t));
  213. struct S_15 {
  214.     union {
  215.         char dummy;
  216.     } U_1;
  217. };
  218. static void CheckNames2 ARGS((Tree_tTree t));
  219. struct S_16 {
  220.     union {
  221.         char dummy;
  222.     } U_1;
  223. };
  224. static void CheckDesignator ARGS((Tree_tTree t));
  225. struct S_17 {
  226.     union {
  227.         char dummy;
  228.     } U_1;
  229. };
  230. static void Identify ARGS((Tree_tTree t));
  231. struct S_18 {
  232.     union {
  233.         char dummy;
  234.     } U_1;
  235. };
  236. static void InitInstance0 ARGS((Tree_tTree t));
  237. struct S_19 {
  238.     union {
  239.         char dummy;
  240.     } U_1;
  241. };
  242. static void CompDP ARGS((Tree_tTree t));
  243. struct S_20 {
  244.     union {
  245.         char dummy;
  246.     } U_1;
  247. };
  248. static void CopyProperties ARGS((Tree_tTree t));
  249. struct S_21 {
  250.     union {
  251.         char dummy;
  252.     } U_1;
  253. };
  254. static void CheckUsage ARGS((Tree_tTree t));
  255. struct S_22 {
  256.     union {
  257.         char dummy;
  258.     } U_1;
  259. };
  260. static void CheckUsage2 ARGS((Tree_tTree t));
  261. struct S_23 {
  262.     union {
  263.         struct {
  264.             struct S_24 {
  265.                 Strings_tString String;
  266.             } yyR1;
  267.         } V_1;
  268.     } U_1;
  269. };
  270. static void CheckInherited ARGS((Tree_tTree t));
  271. struct S_25 {
  272.     union {
  273.         char dummy;
  274.     } U_1;
  275. };
  276. static void CheckComplete ARGS((Tree_tTree t));
  277. struct S_26 {
  278.     union {
  279.         char dummy;
  280.     } U_1;
  281. };
  282. static void CopyRule ARGS((Tree_tTree t));
  283. struct S_27 {
  284.     union {
  285.         char dummy;
  286.     } U_1;
  287. };
  288. static void CopyRule2 ARGS((Tree_tTree t));
  289. struct S_28 {
  290.     union {
  291.         char dummy;
  292.     } U_1;
  293. };
  294. static BOOLEAN IsCopy ARGS((Tree_tTree yyP1));
  295. struct S_29 {
  296.     union {
  297.         struct {
  298.             struct S_30 {
  299.                 Tree_tTree Attr;
  300.                 Tree_tTree ChildsClass;
  301.             } yyR1;
  302.         } V_1;
  303.     } U_1;
  304. };
  305. static BOOLEAN IsWhiteSpace ARGS((Tree_tTree yyP2));
  306. struct S_31 {
  307.     union {
  308.         char dummy;
  309.     } U_1;
  310. };
  311. static BOOLEAN IsWhiteSpace2 ARGS((StringMem_tStringRef yyP3));
  312. struct S_32 {
  313.     union {
  314.         struct {
  315.             struct S_33 {
  316.                 Strings_tString String;
  317.                 CHAR ch;
  318.             } yyR1;
  319.         } V_1;
  320.     } U_1;
  321. };
  322. static void yyExit ARGS(());
  323.  
  324.  
  325. static BOOLEAN LookUp
  326. # ifdef __STDC__
  327. (Idents_tIdent i, Tree_tTree t)
  328. # else
  329. (i, t)
  330. Idents_tIdent i;
  331. Tree_tTree t;
  332. # endif
  333. {
  334.   while (t->U_1.V_1.Kind == Tree_Name) {
  335.     if (t->U_1.V_25.Name.Name == i) {
  336.       return TRUE;
  337.     }
  338.     t = t->U_1.V_25.Name.Next;
  339.   }
  340.   return FALSE;
  341. }
  342.  
  343. static Tree_tTree ProcessIgnore2
  344. # ifdef __STDC__
  345. (Tree_tTree t)
  346. # else
  347. (t)
  348. Tree_tTree t;
  349. # endif
  350. {
  351.   Tree_tTree r;
  352.  
  353.   if (t->U_1.V_1.Kind != Tree_NoAttribute) {
  354.     t->U_1.V_8.AttrOrAction.Next = ProcessIgnore2(t->U_1.V_8.AttrOrAction.Next);
  355.   }
  356.   if (t->U_1.V_1.Kind == Tree_Child && IN(Tree_Ignore, t->U_1.V_9.Child.Properties) || t->U_1.V_1.Kind == Tree_Attribute && IN(Tree_Ignore, t->U_1.V_10.Attribute.Properties) || t->U_1.V_1.Kind == Tree_ActionPart && IN(Tree_Ignore, t->U_1.V_11.ActionPart.Properties)) {
  357.     return t->U_1.V_8.AttrOrAction.Next;
  358.   }
  359.   return t;
  360. }
  361.  
  362. static void CompBaseClass
  363. # ifdef __STDC__
  364. (Tree_tTree t, Tree_tTree b)
  365. # else
  366. (t, b)
  367. Tree_tTree t, b;
  368. # endif
  369. {
  370.   if (t->U_1.V_1.Kind == Tree_Class) {
  371.     t->U_1.V_5.Class.BaseClass = b;
  372.     CompBaseClass(t->U_1.V_5.Class.Next, b);
  373.     CompBaseClass(t->U_1.V_5.Class.Extensions, t);
  374.   }
  375. }
  376.  
  377. static void CompParsIndex
  378. # ifdef __STDC__
  379. (Tree_tTree t, SHORTCARD *Index)
  380. # else
  381. (t, Index)
  382. Tree_tTree t;
  383. SHORTCARD *Index;
  384. # endif
  385. {
  386.   SHORTCARD OldIndex;
  387.  
  388.   OldIndex = *Index;
  389.   switch (t->U_1.V_1.Kind) {
  390.   case Tree_Class:;
  391.     CompParsIndex(t->U_1.V_5.Class.Attributes, Index);
  392.     CompParsIndex(t->U_1.V_5.Class.Extensions, Index);
  393.     CompParsIndex(t->U_1.V_5.Class.Next, &OldIndex);
  394.     break;
  395.   case Tree_Child:;
  396.     INC(*Index);
  397.     t->U_1.V_9.Child.ParsIndex = *Index;
  398.     CompParsIndex(t->U_1.V_9.Child.Next, Index);
  399.     break;
  400.   case Tree_Attribute:;
  401.     CompParsIndex(t->U_1.V_10.Attribute.Next, Index);
  402.     break;
  403.   case Tree_ActionPart:;
  404.     INC(*Index);
  405.     t->U_1.V_11.ActionPart.ParsIndex = *Index;
  406.     INC(ActionCount);
  407.     t->U_1.V_11.ActionPart.Name = ActionCount;
  408.     CompParsIndex(t->U_1.V_11.ActionPart.Next, Index);
  409.     break;
  410.   default :
  411.     break;
  412.   }
  413. }
  414.  
  415. static void CompIndex
  416. # ifdef __STDC__
  417. (Tree_tTree t, SHORTCARD In, SHORTCARD *Out)
  418. # else
  419. (t, In, Out)
  420. Tree_tTree t;
  421. SHORTCARD In;
  422. SHORTCARD *Out;
  423. # endif
  424. {
  425.   switch (t->U_1.V_1.Kind) {
  426.   case Tree_Class:;
  427.     CompIndex(t->U_1.V_5.Class.Attributes, In, Out);
  428.     t->U_1.V_5.Class.AttrCount = *Out;
  429.     CompIndex(t->U_1.V_5.Class.Extensions, *Out, Out);
  430.     CompIndex(t->U_1.V_5.Class.Next, In, Out);
  431.     break;
  432.   case Tree_NoClass:;
  433.     break;
  434.   case Tree_Child:;
  435.     INC(In);
  436.     t->U_1.V_9.Child.AttrIndex = In;
  437.     CompIndex(t->U_1.V_9.Child.Next, In, Out);
  438.     break;
  439.   case Tree_Attribute:;
  440.     INC(In);
  441.     t->U_1.V_10.Attribute.AttrIndex = In;
  442.     CompIndex(t->U_1.V_10.Attribute.Next, In, Out);
  443.     break;
  444.   case Tree_ActionPart:;
  445.     CompIndex(t->U_1.V_11.ActionPart.Next, In, Out);
  446.     break;
  447.   case Tree_NoAttribute:;
  448.     *Out = In;
  449.     break;
  450.   }
  451. }
  452.  
  453. static void CompInstance
  454. # ifdef __STDC__
  455. (Tree_tTree t, SHORTCARD In, SHORTCARD *Out)
  456. # else
  457. (t, In, Out)
  458. Tree_tTree t;
  459. SHORTCARD In;
  460. SHORTCARD *Out;
  461. # endif
  462. {
  463.   switch (t->U_1.V_1.Kind) {
  464.   case Tree_Class:;
  465.     CompInstance(t->U_1.V_5.Class.Attributes, In, Out);
  466.     t->U_1.V_5.Class.InstCount = t->U_1.V_5.Class.AttrCount + *Out;
  467.     MaxInstCount = General_Max((LONGINT)MaxInstCount, (LONGINT)t->U_1.V_5.Class.InstCount);
  468.     CompInstance(t->U_1.V_5.Class.Extensions, *Out, Out);
  469.     CompInstance(t->U_1.V_5.Class.Next, In, Out);
  470.     break;
  471.   case Tree_NoClass:;
  472.     break;
  473.   case Tree_Child:;
  474.     t->U_1.V_9.Child.InstOffset = In;
  475.     if (t->U_1.V_9.Child.Class != Tree_NoTree) {
  476.       CompInstance(t->U_1.V_9.Child.Next, In + t->U_1.V_9.Child.Class->U_1.V_5.Class.AttrCount, Out);
  477.     } else {
  478.       CompInstance(t->U_1.V_9.Child.Next, In, Out);
  479.     }
  480.     break;
  481.   case Tree_Attribute:;
  482.     CompInstance(t->U_1.V_10.Attribute.Next, In, Out);
  483.     break;
  484.   case Tree_ActionPart:;
  485.     CompInstance(t->U_1.V_11.ActionPart.Next, In, Out);
  486.     break;
  487.   case Tree_NoAttribute:;
  488.     *Out = In;
  489.     break;
  490.   }
  491. }
  492.  
  493. static void CompBitCount
  494. # ifdef __STDC__
  495. (Tree_tTree t, SHORTCARD In, SHORTCARD *Out)
  496. # else
  497. (t, In, Out)
  498. Tree_tTree t;
  499. SHORTCARD In;
  500. SHORTCARD *Out;
  501. # endif
  502. {
  503.   switch (t->U_1.V_1.Kind) {
  504.   case Tree_Class:;
  505.     CompBitCount(t->U_1.V_5.Class.Attributes, In, Out);
  506.     t->U_1.V_5.Class.BitCount = *Out;
  507.     CompBitCount(t->U_1.V_5.Class.Extensions, *Out, Out);
  508.     CompBitCount(t->U_1.V_5.Class.Next, In, Out);
  509.     break;
  510.   case Tree_NoClass:;
  511.     break;
  512.   case Tree_Child:;
  513.     if (((SET_ELEM(Tree_Input) | SET_ELEM(Tree_Test) | SET_ELEM(Tree_Dummy)) & t->U_1.V_9.Child.Properties) == 0X0L) {
  514.       INC(In);
  515.     }
  516.     CompBitCount(t->U_1.V_9.Child.Next, In, Out);
  517.     break;
  518.   case Tree_Attribute:;
  519.     if (((SET_ELEM(Tree_Input) | SET_ELEM(Tree_Test) | SET_ELEM(Tree_Dummy)) & t->U_1.V_10.Attribute.Properties) == 0X0L) {
  520.       INC(In);
  521.     }
  522.     CompBitCount(t->U_1.V_10.Attribute.Next, In, Out);
  523.     break;
  524.   case Tree_ActionPart:;
  525.     CompBitCount(t->U_1.V_11.ActionPart.Next, In, Out);
  526.     break;
  527.   case Tree_NoAttribute:;
  528.     *Out = In;
  529.     break;
  530.   }
  531. }
  532.  
  533. static void CompBitOffset
  534. # ifdef __STDC__
  535. (Tree_tTree t, SHORTCARD In, SHORTCARD *Out)
  536. # else
  537. (t, In, Out)
  538. Tree_tTree t;
  539. SHORTCARD In;
  540. SHORTCARD *Out;
  541. # endif
  542. {
  543.   switch (t->U_1.V_1.Kind) {
  544.   case Tree_Class:;
  545.     CompBitOffset(t->U_1.V_5.Class.Attributes, In, Out);
  546.     CompBitOffset(t->U_1.V_5.Class.Extensions, *Out, Out);
  547.     CompBitOffset(t->U_1.V_5.Class.Next, In, Out);
  548.     break;
  549.   case Tree_NoClass:;
  550.     break;
  551.   case Tree_Child:;
  552.     t->U_1.V_9.Child.BitOffset = In;
  553.     if (t->U_1.V_9.Child.Class != Tree_NoTree) {
  554.       CompBitOffset(t->U_1.V_9.Child.Next, In + t->U_1.V_9.Child.Class->U_1.V_5.Class.BitCount, Out);
  555.     } else {
  556.       CompBitOffset(t->U_1.V_9.Child.Next, In, Out);
  557.     }
  558.     break;
  559.   case Tree_Attribute:;
  560.     CompBitOffset(t->U_1.V_10.Attribute.Next, In, Out);
  561.     break;
  562.   case Tree_ActionPart:;
  563.     CompBitOffset(t->U_1.V_11.ActionPart.Next, In, Out);
  564.     break;
  565.   case Tree_NoAttribute:;
  566.     *Out = In;
  567.     break;
  568.   }
  569. }
  570.  
  571. static void InitInstance
  572. # ifdef __STDC__
  573. (Tree_tTree t, SHORTCARD Offset, Tree_tInstancePtr InstancePtr)
  574. # else
  575. (t, Offset, InstancePtr)
  576. Tree_tTree t;
  577. SHORTCARD Offset;
  578. Tree_tInstancePtr InstancePtr;
  579. # endif
  580. {
  581.   switch (t->U_1.V_1.Kind) {
  582.   case Tree_Class:;
  583.     InitInstance(t->U_1.V_5.Class.BaseClass, Offset, InstancePtr);
  584.     InitInstance(t->U_1.V_5.Class.Attributes, Offset, InstancePtr);
  585.     break;
  586.   case Tree_NoClass:;
  587.     break;
  588.   case Tree_Child:;
  589.     {
  590.       register Tree_tInstance *W_1 = &InstancePtr->A[t->U_1.V_9.Child.AttrIndex - 1];
  591.  
  592.       W_1->Attribute = t;
  593.       W_1->Properties = t->U_1.V_9.Child.Properties | (SET_ELEM(Tree_Left));
  594.       W_1->Action = (Tree_tTree)ADR(W_1->Action);
  595.     }
  596.     if (t->U_1.V_9.Child.Class != Tree_NoTree) {
  597.       InitInstance1(t->U_1.V_9.Child.Class, t, Offset + t->U_1.V_9.Child.InstOffset, InstancePtr);
  598.     }
  599.     InitInstance(t->U_1.V_9.Child.Next, Offset, InstancePtr);
  600.     break;
  601.   case Tree_Attribute:;
  602.     {
  603.       register Tree_tInstance *W_2 = &InstancePtr->A[t->U_1.V_10.Attribute.AttrIndex - 1];
  604.  
  605.       W_2->Attribute = t;
  606.       W_2->Properties = t->U_1.V_10.Attribute.Properties | (SET_ELEM(Tree_Left));
  607.       W_2->Action = (Tree_tTree)ADR(W_2->Action);
  608.     }
  609.     InitInstance(t->U_1.V_10.Attribute.Next, Offset, InstancePtr);
  610.     break;
  611.   case Tree_ActionPart:;
  612.     InitInstance(t->U_1.V_11.ActionPart.Next, Offset, InstancePtr);
  613.     break;
  614.   case Tree_NoAttribute:;
  615.     break;
  616.   }
  617. }
  618.  
  619. static void InitInstance1
  620. # ifdef __STDC__
  621. (Tree_tTree t, Tree_tTree selector, SHORTCARD Offset, Tree_tInstancePtr InstancePtr)
  622. # else
  623. (t, selector, Offset, InstancePtr)
  624. Tree_tTree t, selector;
  625. SHORTCARD Offset;
  626. Tree_tInstancePtr InstancePtr;
  627. # endif
  628. {
  629.   switch (t->U_1.V_1.Kind) {
  630.   case Tree_Class:;
  631.     InitInstance1(t->U_1.V_5.Class.BaseClass, selector, Offset, InstancePtr);
  632.     InitInstance1(t->U_1.V_5.Class.Attributes, selector, Offset, InstancePtr);
  633.     break;
  634.   case Tree_NoClass:;
  635.     break;
  636.   case Tree_Child:;
  637.     {
  638.       register Tree_tInstance *W_3 = &InstancePtr->A[Offset + t->U_1.V_9.Child.AttrIndex - 1];
  639.  
  640.       W_3->Selector = selector;
  641.       W_3->Attribute = t;
  642.       W_3->Properties = t->U_1.V_9.Child.Properties | (SET_ELEM(Tree_Right));
  643.       W_3->Action = (Tree_tTree)ADR(W_3->Action);
  644.     }
  645.     InitInstance1(t->U_1.V_9.Child.Next, selector, Offset, InstancePtr);
  646.     break;
  647.   case Tree_Attribute:;
  648.     {
  649.       register Tree_tInstance *W_4 = &InstancePtr->A[Offset + t->U_1.V_10.Attribute.AttrIndex - 1];
  650.  
  651.       W_4->Selector = selector;
  652.       W_4->Attribute = t;
  653.       W_4->Properties = t->U_1.V_10.Attribute.Properties | (SET_ELEM(Tree_Right));
  654.       W_4->Action = (Tree_tTree)ADR(W_4->Action);
  655.     }
  656.     InitInstance1(t->U_1.V_10.Attribute.Next, selector, Offset, InstancePtr);
  657.     break;
  658.   case Tree_ActionPart:;
  659.     InitInstance1(t->U_1.V_11.ActionPart.Next, selector, Offset, InstancePtr);
  660.     break;
  661.   case Tree_NoAttribute:;
  662.     break;
  663.   }
  664. }
  665.  
  666. static void EnterDependency
  667. # ifdef __STDC__
  668. (CARDINAL argument)
  669. # else
  670. (argument)
  671. CARDINAL argument;
  672. # endif
  673. {
  674.   Relations_Include(&relation, result, (LONGINT)argument);
  675. }
  676.  
  677. static void CompDP1
  678. # ifdef __STDC__
  679. (Tree_tTree t, Sets_tSet *Set, INTEGER Usage, BOOLEAN NonBase, BOOLEAN Check)
  680. # else
  681. (t, Set, Usage, NonBase, Check)
  682. Tree_tTree t;
  683. Sets_tSet *Set;
  684. INTEGER Usage;
  685. BOOLEAN NonBase, Check;
  686. # endif
  687. {
  688.   Tree_tTree Attribute, ChildsClass;
  689.   SHORTCARD Offset;
  690.  
  691.   switch (t->U_1.V_1.Kind) {
  692.   case Tree_Class:;
  693.     CompDP1(t->U_1.V_5.Class.BaseClass, Set, Usage, FALSE, Check);
  694.     MultipleInheritedActions = FALSE;
  695.     CompDP1(t->U_1.V_5.Class.Attributes, Set, Usage, NonBase, Check);
  696.     break;
  697.   case Tree_NoClass:;
  698.     break;
  699.   case Tree_Attribute:;
  700.     if (t->U_1.V_10.Attribute.AttrIndex != DummyIndex) {
  701.       Relations_Include(&relation, (LONGINT)DummyIndex, (LONGINT)t->U_1.V_10.Attribute.AttrIndex);
  702.     }
  703.     CompDP1(t->U_1.V_10.Attribute.Next, Set, Usage, NonBase, Check);
  704.     break;
  705.   case Tree_Child:;
  706.     ChildsClass = t->U_1.V_9.Child.Class;
  707.     if (ChildsClass != Tree_NoTree) {
  708.       if (!IN(Tree_Input, t->U_1.V_9.Child.Properties)) {
  709.         Relations_Include(&relation, (LONGINT)DummyIndex, (LONGINT)t->U_1.V_9.Child.AttrIndex);
  710.         {
  711.           SHORTCARD B_1 = 1, B_2 = ChildsClass->U_1.V_5.Class.AttrCount;
  712.  
  713.           if (B_1 <= B_2)
  714.             for (i = B_1;; i += 1) {
  715.               Relations_Include(&relation, (LONGINT)(Class->U_1.V_5.Class.AttrCount + t->U_1.V_9.Child.InstOffset + i), (LONGINT)t->U_1.V_9.Child.AttrIndex);
  716.               if (i >= B_2) break;
  717.             }
  718.         }
  719.       }
  720.       Attribute = Tree_IdentifyAttribute(ChildsClass, iNull);
  721.       Offset = Class->U_1.V_5.Class.AttrCount + t->U_1.V_9.Child.InstOffset + Attribute->U_1.V_9.Child.AttrIndex;
  722.       Relations_Include(&relation, (LONGINT)DummyIndex, (LONGINT)Offset);
  723.       INCL(Class->U_1.V_5.Class.Instance->A[Offset - 1].Properties, Tree_Right);
  724.     }
  725.     CompDP1(t->U_1.V_9.Child.Next, Set, Usage, NonBase, Check);
  726.     break;
  727.   case Tree_ActionPart:;
  728.     if (IN(Tree_MultInhComp, t->U_1.V_11.ActionPart.Properties)) {
  729.       MultipleInheritedActions = TRUE;
  730.     }
  731.     CompDP1(t->U_1.V_11.ActionPart.Actions, Set, Usage, NonBase, Check);
  732.     CompDP1(t->U_1.V_11.ActionPart.Next, Set, Usage, NonBase, Check);
  733.     break;
  734.   case Tree_NoAttribute:;
  735.     break;
  736.   case Tree_Assign:;
  737.     if (IsCopy(t->U_1.V_36.Assign.Arguments)) {
  738.       t->U_1.V_1.Kind = Tree_Copy;
  739.     }
  740.     Sets_AssignEmpty(&Results);
  741.     Sets_AssignEmpty(&Arguments);
  742.     CompDP1(t->U_1.V_36.Assign.Results, &Results, (LONGINT)Tree_Write, NonBase, TRUE);
  743.     CompDP1(t->U_1.V_36.Assign.Arguments, &Arguments, (LONGINT)Tree_Read, NonBase, FALSE);
  744.     if (Sets_IsEmpty(Results)) {
  745.       Tree_Error((LONGINT)AssignmentWithIncorrectLeftHandSide, t->U_1.V_36.Assign.Pos);
  746.     }
  747.     while (!Sets_IsEmpty(Results)) {
  748.       result = Sets_Extract(&Results);
  749.       {
  750.         register Tree_tInstance *W_5 = &Class->U_1.V_5.Class.Instance->A[result - 1];
  751.  
  752.         if (W_5->Action == ADR(W_5->Action) || IN(Tree_MultInhComp, W_5->Properties) || !MultipleInheritedActions) {
  753.           W_5->Action = t;
  754.           if (t->U_1.V_1.Kind == Tree_Copy) {
  755.             W_5->CopyArg = Sets_Select(&Arguments);
  756.           }
  757.         }
  758.       }
  759.       Sets_ForallDo(Arguments, (Sets_ProcOfCard)EnterDependency);
  760.     }
  761.     CompDP1(t->U_1.V_36.Assign.Next, Set, Usage, NonBase, Check);
  762.     break;
  763.   case Tree_Copy:;
  764.     Sets_AssignEmpty(&Results);
  765.     Sets_AssignEmpty(&Arguments);
  766.     CompDP1(t->U_1.V_37.Copy.Results, &Results, (LONGINT)Tree_Write, NonBase, TRUE);
  767.     CompDP1(t->U_1.V_37.Copy.Arguments, &Arguments, (LONGINT)Tree_Read, NonBase, TRUE);
  768.     if (Sets_IsEmpty(Results)) {
  769.       Tree_Error((LONGINT)CopyRuleWithIncorrectLeftHandSide, t->U_1.V_37.Copy.Pos);
  770.     }
  771.     while (!Sets_IsEmpty(Results)) {
  772.       result = Sets_Extract(&Results);
  773.       {
  774.         register Tree_tInstance *W_6 = &Class->U_1.V_5.Class.Instance->A[result - 1];
  775.  
  776.         if (W_6->Action == ADR(W_6->Action) || IN(Tree_MultInhComp, W_6->Properties) || !MultipleInheritedActions) {
  777.           W_6->Action = t;
  778.           W_6->CopyArg = Sets_Select(&Arguments);
  779.         }
  780.       }
  781.       Sets_ForallDo(Arguments, (Sets_ProcOfCard)EnterDependency);
  782.     }
  783.     CompDP1(t->U_1.V_37.Copy.Next, Set, Usage, NonBase, Check);
  784.     break;
  785.   case Tree_TargetCode:;
  786.     Sets_AssignEmpty(&Results);
  787.     Sets_AssignEmpty(&Arguments);
  788.     CompDP1(t->U_1.V_38.TargetCode.Results, &Results, (LONGINT)Tree_Write, NonBase, TRUE);
  789.     CompDP1(t->U_1.V_38.TargetCode.Code, &Arguments, (LONGINT)Tree_Read, NonBase, FALSE);
  790.     Sets_Difference(&Arguments, Results);
  791.     if (Sets_IsEmpty(Results) && IsCode(t->U_1.V_38.TargetCode.Code)) {
  792.       Tree_Error((LONGINT)BlockWithIncorrectLeftHandSide, t->U_1.V_38.TargetCode.Pos);
  793.     }
  794.     while (!Sets_IsEmpty(Results)) {
  795.       result = Sets_Extract(&Results);
  796.       {
  797.         register Tree_tInstance *W_7 = &Class->U_1.V_5.Class.Instance->A[result - 1];
  798.  
  799.         if (W_7->Action == ADR(W_7->Action) || IN(Tree_MultInhComp, W_7->Properties) || !MultipleInheritedActions) {
  800.           W_7->Action = t;
  801.         }
  802.       }
  803.       Sets_ForallDo(Arguments, (Sets_ProcOfCard)EnterDependency);
  804.     }
  805.     CompDP1(t->U_1.V_38.TargetCode.Next, Set, Usage, NonBase, Check);
  806.     break;
  807.   case Tree_Order:;
  808.     Sets_AssignEmpty(&Results);
  809.     Sets_AssignEmpty(&Arguments);
  810.     CompDP1(t->U_1.V_39.Order.Results, &Results, (LONGINT)Tree_Read, NonBase, TRUE);
  811.     CompDP1(t->U_1.V_39.Order.Arguments, &Arguments, (LONGINT)Tree_Read, NonBase, TRUE);
  812.     while (!Sets_IsEmpty(Results)) {
  813.       result = Sets_Extract(&Results);
  814.       Sets_ForallDo(Arguments, (Sets_ProcOfCard)EnterDependency);
  815.     }
  816.     CompDP1(t->U_1.V_39.Order.Next, Set, Usage, NonBase, Check);
  817.     break;
  818.   case Tree_Check:;
  819.     if (t->U_1.V_40.Check.Results != Tree_NoTree) {
  820.       Sets_AssignEmpty(&Results);
  821.       Sets_AssignEmpty(&Arguments);
  822.       CompDP1(t->U_1.V_40.Check.Results, &Results, (LONGINT)Tree_Write, NonBase, FALSE);
  823.     }
  824.     if (t->U_1.V_40.Check.Condition != Tree_NoTree) {
  825.       CompDP1(t->U_1.V_40.Check.Condition, &Arguments, (LONGINT)Tree_Read, NonBase, FALSE);
  826.     }
  827.     if (t->U_1.V_40.Check.Statement != Tree_NoTree) {
  828.       CompDP1(t->U_1.V_40.Check.Statement, &Arguments, (LONGINT)Tree_Read, NonBase, FALSE);
  829.     } else {
  830.       Tree_Warning((LONGINT)CheckWithoutStatement, t->U_1.V_40.Check.Pos);
  831.     }
  832.     CompDP1(t->U_1.V_40.Check.Actions, &Arguments, (LONGINT)Tree_Read, NonBase, FALSE);
  833.     if (t->U_1.V_40.Check.Results != Tree_NoTree) {
  834.       result = Sets_Extract(&Results);
  835.       Class->U_1.V_5.Class.Instance->A[result - 1].Action = t;
  836.       Sets_ForallDo(Arguments, (Sets_ProcOfCard)EnterDependency);
  837.       CompDP1(t->U_1.V_40.Check.Next, Set, Usage, NonBase, Check);
  838.     }
  839.     break;
  840.   case Tree_NoAction:;
  841.     break;
  842.   case Tree_Designator:;
  843.     Attribute = Tree_IdentifyAttribute(Class, t->U_1.V_15.Designator.Selector);
  844.     if (Attribute != Tree_NoTree && Attribute->U_1.V_1.Kind == Tree_Child) {
  845.       ChildsClass = Attribute->U_1.V_9.Child.Class;
  846.       Offset = Class->U_1.V_5.Class.AttrCount + Attribute->U_1.V_9.Child.InstOffset;
  847.       INCL(Attribute->U_1.V_9.Child.Properties, Tree_Read);
  848.       if (ChildsClass != Tree_NoTree) {
  849.         Attribute = Tree_IdentifyAttribute(ChildsClass, t->U_1.V_15.Designator.Attribute);
  850.         if (Attribute != Tree_NoTree) {
  851.           Sets_Include(Set, (LONGCARD)(Offset + Attribute->U_1.V_9.Child.AttrIndex));
  852.           INCL(Attribute->U_1.V_9.Child.Properties, Usage);
  853.           if (Usage == Tree_Write) {
  854.             INCL(Attribute->U_1.V_9.Child.Properties, Tree_Inherited);
  855.             INCL(Class->U_1.V_5.Class.Instance->A[Offset + Attribute->U_1.V_9.Child.AttrIndex - 1].Properties, Tree_Computed);
  856.             if (IN(Tree_Synthesized, Attribute->U_1.V_9.Child.Properties)) {
  857.               Tree_ErrorI((LONGINT)InheritedUseOfSynthesizedAttribute, t->U_1.V_15.Designator.Pos, (LONGINT)Errors_Ident, ADR(t->U_1.V_15.Designator.Attribute));
  858.             }
  859.             {
  860.               register Tree_tInstance *W_8 = &Class->U_1.V_5.Class.Instance->A[Offset + Attribute->U_1.V_9.Child.AttrIndex - 1];
  861.  
  862.               if (NonBase && !MultipleInheritedActions && IN(Tree_NonBaseComp, W_8->Properties) && !IN(Tree_MultInhComp, W_8->Properties)) {
  863.                 Tree_ErrorI((LONGINT)AttributeMultipleComputed, t->U_1.V_15.Designator.Pos, (LONGINT)Errors_Ident, ADR(t->U_1.V_15.Designator.Attribute));
  864.               }
  865.               if (!MultipleInheritedActions || IN(Tree_MultInhComp, W_8->Properties)) {
  866.                 EXCL(W_8->Properties, Tree_MultInhComp);
  867.                 if (NonBase) {
  868.                   INCL(W_8->Properties, Tree_NonBaseComp);
  869.                 }
  870.                 if (MultipleInheritedActions) {
  871.                   INCL(W_8->Properties, Tree_MultInhComp);
  872.                 }
  873.               }
  874.             }
  875.           }
  876.         } else if (Check) {
  877.           Tree_ErrorI((LONGINT)AttributeNotDeclared, t->U_1.V_15.Designator.Pos, (LONGINT)Errors_Ident, ADR(t->U_1.V_15.Designator.Attribute));
  878.         }
  879.       }
  880.     } else if (Check) {
  881.       Tree_ErrorI((LONGINT)SelectorNotDeclared, t->U_1.V_15.Designator.Pos, (LONGINT)Errors_Ident, ADR(t->U_1.V_15.Designator.Selector));
  882.     }
  883.     CompDP1(t->U_1.V_15.Designator.Next, Set, Usage, NonBase, Check);
  884.     break;
  885.   case Tree_Ident:;
  886.     Attribute = Tree_IdentifyAttribute(Class, t->U_1.V_16.Ident.Attribute);
  887.     if (Attribute != Tree_NoTree) {
  888.       Sets_Include(Set, (LONGCARD)Attribute->U_1.V_9.Child.AttrIndex);
  889.       INCL(Attribute->U_1.V_9.Child.Properties, Usage);
  890.       if (Usage == Tree_Write) {
  891.         INCL(Attribute->U_1.V_9.Child.Properties, Tree_Synthesized);
  892.         INCL(Class->U_1.V_5.Class.Instance->A[Attribute->U_1.V_9.Child.AttrIndex - 1].Properties, Tree_Computed);
  893.         if (IN(Tree_Inherited, Attribute->U_1.V_9.Child.Properties)) {
  894.           Tree_ErrorI((LONGINT)SynthesizedUseOfInheritedAttribute, t->U_1.V_16.Ident.Pos, (LONGINT)Errors_Ident, ADR(t->U_1.V_16.Ident.Attribute));
  895.         }
  896.         {
  897.           register Tree_tInstance *W_9 = &Class->U_1.V_5.Class.Instance->A[Attribute->U_1.V_9.Child.AttrIndex - 1];
  898.  
  899.           if (NonBase && !MultipleInheritedActions && IN(Tree_NonBaseComp, W_9->Properties) && !IN(Tree_MultInhComp, W_9->Properties)) {
  900.             Tree_ErrorI((LONGINT)AttributeMultipleComputed, t->U_1.V_16.Ident.Pos, (LONGINT)Errors_Ident, ADR(t->U_1.V_16.Ident.Attribute));
  901.           }
  902.           if (!MultipleInheritedActions || IN(Tree_MultInhComp, W_9->Properties)) {
  903.             EXCL(W_9->Properties, Tree_MultInhComp);
  904.             if (NonBase) {
  905.               INCL(W_9->Properties, Tree_NonBaseComp);
  906.             }
  907.             if (MultipleInheritedActions) {
  908.               INCL(W_9->Properties, Tree_MultInhComp);
  909.             }
  910.           }
  911.         }
  912.       }
  913.     } else if (Check) {
  914.       Tree_ErrorI((LONGINT)AttributeNotDeclared, t->U_1.V_16.Ident.Pos, (LONGINT)Errors_Ident, ADR(t->U_1.V_16.Ident.Attribute));
  915.     }
  916.     CompDP1(t->U_1.V_16.Ident.Next, Set, Usage, NonBase, Check);
  917.     break;
  918.   case Tree_Remote:;
  919.     CompDP1(t->U_1.V_17.Remote.Designators, Set, Usage, NonBase, Check);
  920.     CompDP1(t->U_1.V_17.Remote.Next, Set, Usage, NonBase, Check);
  921.     break;
  922.   case Tree_Any:;
  923.     CompDP1(t->U_1.V_18.Any.Next, Set, Usage, NonBase, Check);
  924.     break;
  925.   case Tree_Anys:;
  926.     CompDP1(t->U_1.V_19.Anys.Next, Set, Usage, NonBase, Check);
  927.     break;
  928.   case Tree_NoDesignator:;
  929.     break;
  930.   }
  931. }
  932.  
  933. static BOOLEAN IsCode
  934. # ifdef __STDC__
  935. (Tree_tTree t)
  936. # else
  937. (t)
  938. Tree_tTree t;
  939. # endif
  940. {
  941.   switch (t->U_1.V_1.Kind) {
  942.   case Tree_Designator:;
  943.   case Tree_Ident:;
  944.   case Tree_Remote:;
  945.     return TRUE;
  946.     break;
  947.   case Tree_Any:;
  948.     return IsCode(t->U_1.V_18.Any.Next);
  949.     break;
  950.   case Tree_Anys:;
  951.     return IsCode(t->U_1.V_19.Anys.Next);
  952.     break;
  953.   case Tree_NoDesignator:;
  954.     return FALSE;
  955.     break;
  956.   }
  957. }
  958.  
  959. static Tree_tTree CopyTree
  960. # ifdef __STDC__
  961. (Tree_tTree t)
  962. # else
  963. (t)
  964. Tree_tTree t;
  965. # endif
  966. {
  967.   switch (t->U_1.V_1.Kind) {
  968.   case Tree_Attribute:;
  969.     {
  970.       register Tree_yAttribute *W_10 = &t->U_1.V_10.Attribute;
  971.  
  972.       return Tree_mAttribute(CopyTree(W_10->Next), W_10->Name, W_10->Type, W_10->Properties, W_10->Pos);
  973.     }
  974.     break;
  975.   case Tree_Child:;
  976.     {
  977.       register Tree_yChild *W_11 = &t->U_1.V_9.Child;
  978.  
  979.       return Tree_mChild(CopyTree(W_11->Next), W_11->Name, W_11->Type, W_11->Properties, W_11->Pos);
  980.     }
  981.     break;
  982.   case Tree_ActionPart:;
  983.     {
  984.       register Tree_yActionPart *W_12 = &t->U_1.V_11.ActionPart;
  985.  
  986.       return Tree_mActionPart(CopyTree(W_12->Next), W_12->Actions);
  987.     }
  988.     break;
  989.   case Tree_NoAttribute:;
  990.     return Tree_nNoAttribute;
  991.     break;
  992.   }
  993. }
  994.  
  995. static void ExpandMultiple
  996. # ifdef __STDC__
  997. (Tree_tTree Class)
  998. # else
  999. (Class)
  1000. Tree_tTree Class;
  1001. # endif
  1002. {
  1003.   Tree_tTree Node, class;
  1004.  
  1005.   {
  1006.     register Tree_yClass *W_13 = &Class->U_1.V_5.Class;
  1007.  
  1008.     if (!IN(Tree_Mark, W_13->Properties)) {
  1009.       INCL(W_13->Properties, Tree_Mark);
  1010.       if (W_13->BaseClass->U_1.V_1.Kind == Tree_Class) {
  1011.         ExpandMultiple(W_13->BaseClass);
  1012.       }
  1013.       Node = W_13->Names;
  1014.       while (Node->U_1.V_1.Kind == Tree_Name) {
  1015.         {
  1016.           register Tree_yName *W_14 = &Node->U_1.V_25.Name;
  1017.  
  1018.           class = Tree_IdentifyClass(Tree_TreeRoot->U_1.V_26.Ag.Classes, W_14->Name);
  1019.           if (class != Tree_NoTree) {
  1020.             ExpandMultiple(class);
  1021.             TheClass = Class;
  1022.             Tree_ForallAttributes(class, (Tree_ProcOfT)ExpandMultiple2);
  1023.           }
  1024.           Node = W_14->Next;
  1025.         }
  1026.       }
  1027.       EXCL(W_13->Properties, Tree_Mark);
  1028.     }
  1029.   }
  1030. }
  1031.  
  1032. static void AppendAttr
  1033. # ifdef __STDC__
  1034. (Tree_tTree *Attributes, Tree_tTree Attribute)
  1035. # else
  1036. (Attributes, Attribute)
  1037. Tree_tTree *Attributes;
  1038. Tree_tTree Attribute;
  1039. # endif
  1040. {
  1041.   if ((*Attributes)->U_1.V_1.Kind == Tree_NoAttribute) {
  1042.     Attribute->U_1.V_8.AttrOrAction.Next = *Attributes;
  1043.     *Attributes = Attribute;
  1044.   } else {
  1045.     AppendAttr(&(*Attributes)->U_1.V_8.AttrOrAction.Next, Attribute);
  1046.   }
  1047. }
  1048.  
  1049. static void yyAbort
  1050. # ifdef __STDC__
  1051. (CHAR yyFunction[], LONGCARD O_1)
  1052. # else
  1053. (yyFunction, O_1)
  1054. CHAR yyFunction[];
  1055. LONGCARD O_1;
  1056. # endif
  1057. {
  1058.   OPEN_ARRAY_LOCALS
  1059.  
  1060.   ALLOC_OPEN_ARRAYS(O_1 * sizeof(CHAR), 1)
  1061.   COPY_OPEN_ARRAY(yyFunction, O_1, CHAR)
  1062.   IO_WriteS((System_tFile)IO_StdError, (STRING)"Error: module Semantics, routine ", 33L);
  1063.   IO_WriteS((System_tFile)IO_StdError, yyFunction, O_1);
  1064.   IO_WriteS((System_tFile)IO_StdError, (STRING)" failed", 7L);
  1065.   IO_WriteNl((System_tFile)IO_StdError);
  1066.   (*Semantics_Exit)();
  1067.   FREE_OPEN_ARRAYS
  1068. }
  1069.  
  1070. static BOOLEAN yyIsEqual
  1071. # ifdef __STDC__
  1072. (BYTE yya[], LONGCARD O_3, BYTE yyb[], LONGCARD O_2)
  1073. # else
  1074. (yya, O_3, yyb, O_2)
  1075. BYTE yya[];
  1076. LONGCARD O_3;
  1077. BYTE yyb[];
  1078. LONGCARD O_2;
  1079. # endif
  1080. {
  1081.   INTEGER yyi;
  1082.   OPEN_ARRAY_LOCALS
  1083.  
  1084.   ALLOC_OPEN_ARRAYS(O_2 * sizeof(WORD) + O_3 * sizeof(WORD), 2)
  1085.   COPY_OPEN_ARRAY(yyb, O_2, WORD)
  1086.   COPY_OPEN_ARRAY(yya, O_3, WORD)
  1087.   {
  1088.     LONGINT B_3 = 0, B_4 = (INTEGER)(O_3 - 1);
  1089.  
  1090.     if (B_3 <= B_4)
  1091.       for (yyi = B_3;; yyi += 1) {
  1092.         if (yya[yyi] != yyb[yyi]) {
  1093.           FREE_OPEN_ARRAYS
  1094.           return FALSE;
  1095.         }
  1096.         if (yyi >= B_4) break;
  1097.       }
  1098.   }
  1099.   FREE_OPEN_ARRAYS
  1100.   return TRUE;
  1101. }
  1102.  
  1103. void Semantics_Semantics
  1104. # ifdef __STDC__
  1105. (Tree_tTree t)
  1106. # else
  1107. (t)
  1108. Tree_tTree t;
  1109. # endif
  1110. {
  1111.   struct S_3 yyTempo;
  1112.  
  1113.   if (t == Tree_NoTree) {
  1114.     return;
  1115.   }
  1116.   if (t->U_1.V_1.Kind == Tree_Ag) {
  1117.     {
  1118.       register Tree_yAg *W_15 = &t->U_1.V_26.Ag;
  1119.  
  1120.       Tree_InitIdentifyClass(W_15->Classes);
  1121.       Tree_ForallClasses(W_15->Classes, (Tree_ProcOfT)StampItems);
  1122.       StampItems(W_15->Modules);
  1123.       ExpandProps(W_15->Props);
  1124.       ExpandProps(W_15->Modules);
  1125.       if (IN(Tree_Ignore, W_15->Properties)) {
  1126.         ProcessIgnore(W_15->ParserCodes);
  1127.         ProcessIgnore(W_15->TreeCodes);
  1128.         ProcessIgnore(W_15->EvalCodes);
  1129.       }
  1130.       ProcessIgnore(W_15->Decls);
  1131.       Tree_ForallClasses(W_15->Classes, (Tree_ProcOfT)ProcessIgnore);
  1132.       ProcessIgnore(W_15->Modules);
  1133.       ExpandModules(W_15->Decls);
  1134.       ExpandModules(W_15->Modules);
  1135.       if (Sets_IsElement(ORD('c'), &Tree_Options)) {
  1136.         Strings_ArrayToString((STRING)"bool", 4L, &String);
  1137.       } else {
  1138.         Strings_ArrayToString((STRING)"BOOLEAN", 7L, &String);
  1139.       }
  1140.       Ident = Idents_MakeIdent(&String);
  1141.       Semantics_TypeCount = Idents_MaxIdent();
  1142.       Sets_MakeSet(&Tree_TypeNames, (LONGCARD)Semantics_TypeCount);
  1143.       Sets_Include(&Tree_TypeNames, (LONGCARD)Ident);
  1144.       Semantics_Semantics(W_15->Classes);
  1145.       return;
  1146.     }
  1147.   }
  1148.   if (t->U_1.V_1.Kind == Tree_Class) {
  1149.     {
  1150.       register Tree_yClass *W_16 = &t->U_1.V_5.Class;
  1151.  
  1152.       CompBaseClass(t, Tree_nNoClass);
  1153.       Tree_ForallClasses(t, (Tree_ProcOfT)ExpandMultiple);
  1154.       Tree_ClassCount = 0;
  1155.       Sets_MakeSet(&CodesUsed, (LONGCARD)Idents_MaxIdent());
  1156.       Tree_ForallClasses(t, (Tree_ProcOfT)CountClasses);
  1157.       Tree_ForallClasses(t, (Tree_ProcOfT)CheckReverse);
  1158.       INCL(t->U_1.V_5.Class.Properties, Tree_Referenced);
  1159.       CompReachable(t);
  1160.       if (Sets_IsElement(ORD('x'), &Tree_Options) || Sets_IsElement(ORD('z'), &Tree_Options) || Sets_IsElement(ORD('u'), &Tree_Options)) {
  1161.         TokenCode = 0;
  1162.         Tree_ForallClasses(t, (Tree_ProcOfT)CodeTerminals);
  1163.         ActionCount = 0;
  1164.         i = 0;
  1165.         CompParsIndex(t, &i);
  1166.         Tree_ForallClasses(t, (Tree_ProcOfT)CheckUsage2);
  1167.       }
  1168.       Tree_ForallClasses(t, (Tree_ProcOfT)ExpandChecks);
  1169.       Tree_ForallClasses(t, (Tree_ProcOfT)Identify);
  1170.       Sets_MakeSet(&ClassNames, (LONGCARD)Idents_MaxIdent());
  1171.       Sets_MakeSet(&SelectorNames, (LONGCARD)Idents_MaxIdent());
  1172.       Sets_MakeSet(&VariantNames, (LONGCARD)Idents_MaxIdent());
  1173.       Sets_MakeSet(&PrecNames, (LONGCARD)Idents_MaxIdent());
  1174.       CheckNames(Tree_TreeRoot->U_1.V_26.Ag.Precs);
  1175.       Tree_ForallClasses(t, (Tree_ProcOfT)CheckNames);
  1176.       Sets_ReleaseSet(&ClassNames);
  1177.       Sets_ReleaseSet(&SelectorNames);
  1178.       Sets_ReleaseSet(&VariantNames);
  1179.       Sets_ReleaseSet(&PrecNames);
  1180.       Sets_ReleaseSet(&CodesUsed);
  1181.       Tree_ForallClasses(t, (Tree_ProcOfT)CheckDesignator);
  1182.       CompBitCount(t, 1, &i);
  1183.       CompBitOffset(t, 0, &i);
  1184.       if (Sets_IsElement(ORD('.'), &Tree_Options)) {
  1185.         CompIndex(t, 0, &i);
  1186.         CompInstance(t, 0, &i);
  1187.         Sets_MakeSet(&Tree_MaxSet, (LONGCARD)MaxInstCount);
  1188.         Sets_Complement(&Tree_MaxSet);
  1189.         Tree_ForallClasses(t, (Tree_ProcOfT)InitInstance0);
  1190.         Tree_ForallClasses(t, (Tree_ProcOfT)CompDP);
  1191.         if (Sets_IsElement(ORD('2'), &Tree_Options)) {
  1192.           IO_WriteNl((System_tFile)IO_StdOutput);
  1193.           IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Inherited Attribute Computation Rules", 37L);
  1194.           IO_WriteNl((System_tFile)IO_StdOutput);
  1195.           IO_WriteS((System_tFile)IO_StdOutput, (STRING)"-------------------------------------", 37L);
  1196.           IO_WriteNl((System_tFile)IO_StdOutput);
  1197.           IO_WriteNl((System_tFile)IO_StdOutput);
  1198.         }
  1199.         Tree_ForallClasses(t, (Tree_ProcOfT)CopyProperties);
  1200.         Tree_ForallClasses(t, (Tree_ProcOfT)CheckInherited);
  1201.         if (Sets_IsElement(ORD('1'), &Tree_Options)) {
  1202.           IO_WriteNl((System_tFile)IO_StdOutput);
  1203.           IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Inserted Copy Rules", 19L);
  1204.           IO_WriteNl((System_tFile)IO_StdOutput);
  1205.           IO_WriteS((System_tFile)IO_StdOutput, (STRING)"-------------------", 19L);
  1206.           IO_WriteNl((System_tFile)IO_StdOutput);
  1207.           IO_WriteNl((System_tFile)IO_StdOutput);
  1208.         }
  1209.         Success = TRUE;
  1210.         Tree_ForallClasses(t, (Tree_ProcOfT)CheckComplete);
  1211.         if (Success) {
  1212.           INCL(Tree_GrammarClass, Tree_cLNC);
  1213.         }
  1214.         if (CopyInherited > 0) {
  1215.           Tree_InformationI((LONGINT)CopyRuleInsertionsInherited, t->U_1.V_5.Class.Pos, (LONGINT)Errors_Integer, ADR(CopyInherited));
  1216.         }
  1217.         if (CopySynthesized > 0) {
  1218.           Tree_InformationI((LONGINT)CopyRuleInsertionsSynthesized, t->U_1.V_5.Class.Pos, (LONGINT)Errors_Integer, ADR(CopySynthesized));
  1219.         }
  1220.         if (CopyThreaded > 0) {
  1221.           Tree_InformationI((LONGINT)CopyRuleInsertionsThreaded, t->U_1.V_5.Class.Pos, (LONGINT)Errors_Integer, ADR(CopyThreaded));
  1222.         }
  1223.         Tree_ForallClasses(t, (Tree_ProcOfT)CheckUsage);
  1224.       }
  1225.       return;
  1226.     }
  1227.   }
  1228. }
  1229.  
  1230. static void StampItems
  1231. # ifdef __STDC__
  1232. (Tree_tTree t)
  1233. # else
  1234. (t)
  1235. Tree_tTree t;
  1236. # endif
  1237. {
  1238.   struct S_4 yyTempo;
  1239.  
  1240.   if (t == Tree_NoTree) {
  1241.     return;
  1242.   }
  1243.   if (t->U_1.V_1.Kind == Tree_Module) {
  1244.     {
  1245.       register Tree_yModule *W_17 = &t->U_1.V_43.Module;
  1246.  
  1247.       Tree_ForallClasses(W_17->Classes, (Tree_ProcOfT)StampItems);
  1248.       StampItems(W_17->Next);
  1249.       return;
  1250.     }
  1251.   }
  1252.   if (t->U_1.V_1.Kind == Tree_Class) {
  1253.     {
  1254.       register Tree_yClass *W_18 = &t->U_1.V_5.Class;
  1255.  
  1256.       if (IN(Tree_Abstract, W_18->Properties)) {
  1257.         Tree_ForallAttributes(W_18->Attributes, (Tree_ProcOfT)StampItems);
  1258.       }
  1259.       return;
  1260.     }
  1261.   }
  1262.   if (t->U_1.V_1.Kind == Tree_Child) {
  1263.     {
  1264.       register Tree_yChild *W_19 = &t->U_1.V_9.Child;
  1265.  
  1266.       INC(ItemCount);
  1267.       W_19->Item = ItemCount;
  1268.       return;
  1269.     }
  1270.   }
  1271.   if (t->U_1.V_1.Kind == Tree_Attribute) {
  1272.     {
  1273.       register Tree_yAttribute *W_20 = &t->U_1.V_10.Attribute;
  1274.  
  1275.       INC(ItemCount);
  1276.       W_20->Item = ItemCount;
  1277.       return;
  1278.     }
  1279.   }
  1280.   if (t->U_1.V_1.Kind == Tree_ActionPart) {
  1281.     {
  1282.       register Tree_yActionPart *W_21 = &t->U_1.V_11.ActionPart;
  1283.  
  1284.       INC(ItemCount);
  1285.       W_21->Item = ItemCount;
  1286.       return;
  1287.     }
  1288.   }
  1289. }
  1290.  
  1291. static void ExpandProps
  1292. # ifdef __STDC__
  1293. (Tree_tTree t)
  1294. # else
  1295. (t)
  1296. Tree_tTree t;
  1297. # endif
  1298. {
  1299.   struct S_5 yyTempo;
  1300.  
  1301.   if (t == Tree_NoTree) {
  1302.     return;
  1303.   }
  1304.   switch (t->U_1.V_1.Kind) {
  1305.   case Tree_Module:;
  1306.     {
  1307.       register Tree_yModule *W_22 = &t->U_1.V_43.Module;
  1308.  
  1309.       ExpandProps(W_22->Props);
  1310.       ExpandProps(W_22->Next);
  1311.       return;
  1312.     }
  1313.     break;
  1314.   case Tree_Prop:;
  1315.     {
  1316.       register Tree_yProp *W_23 = &t->U_1.V_46.Prop;
  1317.  
  1318.       ActProperties = W_23->Properties;
  1319.       ExpandProps(W_23->Names);
  1320.       ExpandProps(W_23->Next);
  1321.       return;
  1322.     }
  1323.     break;
  1324.   case Tree_Select:;
  1325.     {
  1326.       register Tree_ySelect *W_24 = &t->U_1.V_47.Select;
  1327.  
  1328.       CheckSelect(W_24->Names);
  1329.       ActProperties = SET_ELEM(Tree_Ignore);
  1330.       if (!LookUp(Tree_TreeRoot->U_1.V_26.Ag.Name, W_24->Names)) {
  1331.         Tree_TreeRoot->U_1.V_26.Ag.Properties = Tree_TreeRoot->U_1.V_26.Ag.Properties | ActProperties;
  1332.         ExpandProps(Tree_TreeRoot->U_1.V_26.Ag.Decls);
  1333.         Tree_ForallClasses(Tree_TreeRoot->U_1.V_26.Ag.Classes, (Tree_ProcOfT)ExpandProps);
  1334.       }
  1335.       Module = Tree_TreeRoot->U_1.V_26.Ag.Modules;
  1336.       while (Module->U_1.V_1.Kind == Tree_Module) {
  1337.         if (!LookUp(Module->U_1.V_43.Module.Name, W_24->Names)) {
  1338.           Module->U_1.V_43.Module.Properties = Module->U_1.V_43.Module.Properties | ActProperties;
  1339.           ExpandProps(Module->U_1.V_43.Module.Decls);
  1340.           Tree_ForallClasses(Module->U_1.V_43.Module.Classes, (Tree_ProcOfT)ExpandProps);
  1341.         }
  1342.         Module = Module->U_1.V_43.Module.Next;
  1343.       }
  1344.       ExpandProps(W_24->Next);
  1345.       return;
  1346.     }
  1347.     break;
  1348.   case Tree_Name:;
  1349.     {
  1350.       register Tree_yName *W_25 = &t->U_1.V_25.Name;
  1351.  
  1352.       if (W_25->Name == Tree_TreeRoot->U_1.V_26.Ag.Name) {
  1353.         Tree_TreeRoot->U_1.V_26.Ag.Properties = Tree_TreeRoot->U_1.V_26.Ag.Properties | ActProperties;
  1354.         ExpandProps(Tree_TreeRoot->U_1.V_26.Ag.Decls);
  1355.         Tree_ForallClasses(Tree_TreeRoot->U_1.V_26.Ag.Classes, (Tree_ProcOfT)ExpandProps);
  1356.       } else {
  1357.         Module = Tree_IdentifyModule(Tree_TreeRoot->U_1.V_26.Ag.Modules, W_25->Name);
  1358.         if (Module == Tree_NoTree) {
  1359.           Tree_WarningI((LONGINT)ModuleNotDeclared, t->U_1.V_25.Name.Pos, (LONGINT)Errors_Ident, ADR(W_25->Name));
  1360.         } else {
  1361.           Module->U_1.V_43.Module.Properties = Module->U_1.V_43.Module.Properties | ActProperties;
  1362.           ExpandProps(Module->U_1.V_43.Module.Decls);
  1363.           Tree_ForallClasses(Module->U_1.V_43.Module.Classes, (Tree_ProcOfT)ExpandProps);
  1364.         }
  1365.       }
  1366.       ExpandProps(W_25->Next);
  1367.       return;
  1368.     }
  1369.     break;
  1370.   case Tree_Decl:;
  1371.     {
  1372.       register Tree_yDecl *W_26 = &t->U_1.V_50.Decl;
  1373.  
  1374.       Tree_ForallAttributes(W_26->Attributes, (Tree_ProcOfT)ExpandProps);
  1375.       ExpandProps(W_26->Next);
  1376.       return;
  1377.     }
  1378.     break;
  1379.   case Tree_Class:;
  1380.     {
  1381.       register Tree_yClass *W_27 = &t->U_1.V_5.Class;
  1382.  
  1383.       W_27->Properties = W_27->Properties | ActProperties;
  1384.       Tree_ForallAttributes(W_27->Attributes, (Tree_ProcOfT)ExpandProps);
  1385.       return;
  1386.     }
  1387.     break;
  1388.   case Tree_Child:;
  1389.     {
  1390.       register Tree_yChild *W_28 = &t->U_1.V_9.Child;
  1391.  
  1392.       W_28->Properties = W_28->Properties | ActProperties;
  1393.       return;
  1394.     }
  1395.     break;
  1396.   case Tree_Attribute:;
  1397.     {
  1398.       register Tree_yAttribute *W_29 = &t->U_1.V_10.Attribute;
  1399.  
  1400.       W_29->Properties = W_29->Properties | ActProperties;
  1401.       return;
  1402.     }
  1403.     break;
  1404.   case Tree_ActionPart:;
  1405.     {
  1406.       register Tree_yActionPart *W_30 = &t->U_1.V_11.ActionPart;
  1407.  
  1408.       W_30->Properties = W_30->Properties | ActProperties;
  1409.       return;
  1410.     }
  1411.     break;
  1412.   default :
  1413.     break;
  1414.   }
  1415. }
  1416.  
  1417. static void CheckSelect
  1418. # ifdef __STDC__
  1419. (Tree_tTree t)
  1420. # else
  1421. (t)
  1422. Tree_tTree t;
  1423. # endif
  1424. {
  1425.   struct S_6 yyTempo;
  1426.  
  1427.   if (t == Tree_NoTree) {
  1428.     return;
  1429.   }
  1430.   if (t->U_1.V_1.Kind == Tree_Name) {
  1431.     {
  1432.       register Tree_yName *W_31 = &t->U_1.V_25.Name;
  1433.  
  1434.       if (!(W_31->Name == Tree_TreeRoot->U_1.V_26.Ag.Name || Tree_IdentifyModule(Tree_TreeRoot->U_1.V_26.Ag.Modules, W_31->Name) != Tree_NoTree)) {
  1435.         Tree_WarningI((LONGINT)ModuleNotDeclared, t->U_1.V_25.Name.Pos, (LONGINT)Errors_Ident, ADR(W_31->Name));
  1436.       }
  1437.       CheckSelect(W_31->Next);
  1438.       return;
  1439.     }
  1440.   }
  1441. }
  1442.  
  1443. static void ProcessIgnore
  1444. # ifdef __STDC__
  1445. (Tree_tTree t)
  1446. # else
  1447. (t)
  1448. Tree_tTree t;
  1449. # endif
  1450. {
  1451.   struct S_7 yyTempo;
  1452.  
  1453.   if (t == Tree_NoTree) {
  1454.     return;
  1455.   }
  1456.   if (t->U_1.V_1.Kind == Tree_Module) {
  1457.     {
  1458.       register Tree_yModule *W_32 = &t->U_1.V_43.Module;
  1459.  
  1460.       if (IN(Tree_Ignore, W_32->Properties)) {
  1461.         ProcessIgnore(W_32->ParserCodes);
  1462.         ProcessIgnore(W_32->TreeCodes);
  1463.         ProcessIgnore(W_32->EvalCodes);
  1464.       }
  1465.       ProcessIgnore(W_32->Decls);
  1466.       Tree_ForallClasses(W_32->Classes, (Tree_ProcOfT)ProcessIgnore);
  1467.       ProcessIgnore(W_32->Next);
  1468.       return;
  1469.     }
  1470.   }
  1471.   if (t->U_1.V_1.Kind == Tree_Codes) {
  1472.     {
  1473.       register Tree_yCodes *W_33 = &t->U_1.V_12.Codes;
  1474.  
  1475.       Texts_MakeText(&W_33->Export);
  1476.       Texts_MakeText(&W_33->Import);
  1477.       Texts_MakeText(&W_33->Global);
  1478.       Texts_MakeText(&W_33->Local);
  1479.       Texts_MakeText(&W_33->Begin);
  1480.       Texts_MakeText(&W_33->Close);
  1481.       return;
  1482.     }
  1483.   }
  1484.   if (t->U_1.V_1.Kind == Tree_Decl) {
  1485.     {
  1486.       register Tree_yDecl *W_34 = &t->U_1.V_50.Decl;
  1487.  
  1488.       W_34->Attributes = ProcessIgnore2(W_34->Attributes);
  1489.       ProcessIgnore(W_34->Next);
  1490.       return;
  1491.     }
  1492.   }
  1493.   if (t->U_1.V_1.Kind == Tree_Class) {
  1494.     {
  1495.       register Tree_yClass *W_35 = &t->U_1.V_5.Class;
  1496.  
  1497.       W_35->Attributes = ProcessIgnore2(W_35->Attributes);
  1498.       if (IN(Tree_Ignore, W_35->Properties)) {
  1499.         W_35->Names = Tree_nNoName;
  1500.       }
  1501.       return;
  1502.     }
  1503.   }
  1504. }
  1505.  
  1506. static void ExpandModules
  1507. # ifdef __STDC__
  1508. (Tree_tTree t)
  1509. # else
  1510. (t)
  1511. Tree_tTree t;
  1512. # endif
  1513. {
  1514.   struct S_8 yyTempo;
  1515.  
  1516.   if (t == Tree_NoTree) {
  1517.     return;
  1518.   }
  1519.   if (t->U_1.V_1.Kind == Tree_Module) {
  1520.     {
  1521.       register Tree_yModule *W_36 = &t->U_1.V_43.Module;
  1522.  
  1523.       ExpandModules(W_36->Decls);
  1524.       ExpandModules(W_36->Classes);
  1525.       ExpandModules(W_36->Next);
  1526.       return;
  1527.     }
  1528.   }
  1529.   if (t->U_1.V_1.Kind == Tree_Decl) {
  1530.     {
  1531.       register Tree_yDecl *W_37 = &t->U_1.V_50.Decl;
  1532.  
  1533.       Attribute = W_37->Attributes;
  1534.       ActProperties = W_37->Properties;
  1535.       ExpandModules(W_37->Names);
  1536.       ExpandModules(W_37->Next);
  1537.       return;
  1538.     }
  1539.   }
  1540.   if (t->U_1.V_1.Kind == Tree_Name) {
  1541.     {
  1542.       register Tree_yName *W_38 = &t->U_1.V_25.Name;
  1543.  
  1544.       Class = Tree_IdentifyClass(Tree_TreeRoot->U_1.V_26.Ag.Classes, W_38->Name);
  1545.       if (Class == Tree_NoTree) {
  1546.         if (Tree_TreeRoot->U_1.V_26.Ag.Classes->U_1.V_1.Kind == Tree_NoClass) {
  1547.           Tree_TreeRoot->U_1.V_26.Ag.Classes = Tree_mClass(W_38->Name, ActProperties, CopyTree(Attribute), Tree_nNoClass, Tree_TreeRoot->U_1.V_26.Ag.Classes, W_38->Name, W_38->Pos, 0, Idents_NoIdent, Tree_nNoName);
  1548.           Tree_InitIdentifyClass2(Tree_TreeRoot->U_1.V_26.Ag.Classes);
  1549.         } else {
  1550.           Node = Tree_TreeRoot->U_1.V_26.Ag.Classes;
  1551.           while (Node->U_1.V_5.Class.Next->U_1.V_1.Kind != Tree_NoClass) {
  1552.             Node = Node->U_1.V_5.Class.Next;
  1553.           }
  1554.           Node->U_1.V_5.Class.Next = Tree_mClass(W_38->Name, ActProperties, CopyTree(Attribute), Tree_nNoClass, Node->U_1.V_5.Class.Next, W_38->Name, W_38->Pos, 0, Idents_NoIdent, Tree_nNoName);
  1555.           Tree_InitIdentifyClass2(Node->U_1.V_5.Class.Next);
  1556.         }
  1557.       } else {
  1558.         if (Class->U_1.V_5.Class.Attributes->U_1.V_1.Kind == Tree_NoAttribute) {
  1559.           Class->U_1.V_5.Class.Attributes = CopyTree(Attribute);
  1560.         } else {
  1561.           Node = Class->U_1.V_5.Class.Attributes;
  1562.           while (Node->U_1.V_10.Attribute.Next->U_1.V_1.Kind != Tree_NoAttribute) {
  1563.             Node = Node->U_1.V_10.Attribute.Next;
  1564.           }
  1565.           Node->U_1.V_10.Attribute.Next = CopyTree(Attribute);
  1566.         }
  1567.       }
  1568.       ExpandModules(W_38->Next);
  1569.       return;
  1570.     }
  1571.   }
  1572.   if (t->U_1.V_1.Kind == Tree_Class) {
  1573.     {
  1574.       register Tree_yClass *W_39 = &t->U_1.V_5.Class;
  1575.  
  1576.       Class = Tree_IdentifyClass(Tree_TreeRoot->U_1.V_26.Ag.Classes, W_39->Name);
  1577.       Tree_ForallClasses(W_39->Extensions, (Tree_ProcOfT)Tree_InitIdentifyClass2);
  1578.       if (Class == Tree_NoTree) {
  1579.         if (Tree_TreeRoot->U_1.V_26.Ag.Classes->U_1.V_1.Kind == Tree_NoClass) {
  1580.           Tree_TreeRoot->U_1.V_26.Ag.Classes = Tree_mClass(W_39->Name, W_39->Properties, W_39->Attributes, W_39->Extensions, Tree_TreeRoot->U_1.V_26.Ag.Classes, W_39->Selector, W_39->Pos, W_39->Code, W_39->Prec, W_39->Names);
  1581.           Tree_InitIdentifyClass2(Tree_TreeRoot->U_1.V_26.Ag.Classes);
  1582.         } else {
  1583.           Node = Tree_TreeRoot->U_1.V_26.Ag.Classes;
  1584.           while (Node->U_1.V_5.Class.Next->U_1.V_1.Kind != Tree_NoClass) {
  1585.             Node = Node->U_1.V_5.Class.Next;
  1586.           }
  1587.           Node->U_1.V_5.Class.Next = Tree_mClass(W_39->Name, W_39->Properties, W_39->Attributes, W_39->Extensions, Node->U_1.V_5.Class.Next, W_39->Selector, W_39->Pos, W_39->Code, W_39->Prec, W_39->Names);
  1588.           Tree_InitIdentifyClass2(Node->U_1.V_5.Class.Next);
  1589.         }
  1590.       } else {
  1591.         if (Class->U_1.V_5.Class.Attributes->U_1.V_1.Kind == Tree_NoAttribute) {
  1592.           Class->U_1.V_5.Class.Attributes = W_39->Attributes;
  1593.         } else {
  1594.           Node = Class->U_1.V_5.Class.Attributes;
  1595.           while (Node->U_1.V_10.Attribute.Next->U_1.V_1.Kind != Tree_NoAttribute) {
  1596.             Node = Node->U_1.V_10.Attribute.Next;
  1597.           }
  1598.           Node->U_1.V_10.Attribute.Next = W_39->Attributes;
  1599.         }
  1600.         if (Class->U_1.V_5.Class.Extensions->U_1.V_1.Kind == Tree_NoClass) {
  1601.           Class->U_1.V_5.Class.Extensions = W_39->Extensions;
  1602.         } else {
  1603.           Node = Class->U_1.V_5.Class.Extensions;
  1604.           while (Node->U_1.V_5.Class.Next->U_1.V_1.Kind != Tree_NoClass) {
  1605.             Node = Node->U_1.V_5.Class.Next;
  1606.           }
  1607.           Node->U_1.V_5.Class.Next = W_39->Extensions;
  1608.         }
  1609.         if (Class->U_1.V_5.Class.Names->U_1.V_1.Kind == Tree_NoName) {
  1610.           Class->U_1.V_5.Class.Names = W_39->Names;
  1611.         } else {
  1612.           Node = Class->U_1.V_5.Class.Names;
  1613.           while (Node->U_1.V_25.Name.Next->U_1.V_1.Kind != Tree_NoName) {
  1614.             Node = Node->U_1.V_25.Name.Next;
  1615.           }
  1616.           Node->U_1.V_25.Name.Next = W_39->Names;
  1617.         }
  1618.       }
  1619.       ExpandModules(W_39->Next);
  1620.       return;
  1621.     }
  1622.   }
  1623. }
  1624.  
  1625. static void ExpandChecks
  1626. # ifdef __STDC__
  1627. (Tree_tTree t)
  1628. # else
  1629. (t)
  1630. Tree_tTree t;
  1631. # endif
  1632. {
  1633.   struct S_9 yyTempo;
  1634.  
  1635.   if (t == Tree_NoTree) {
  1636.     return;
  1637.   }
  1638.   switch (t->U_1.V_1.Kind) {
  1639.   case Tree_Class:;
  1640.     {
  1641.       register Tree_yClass *W_40 = &t->U_1.V_5.Class;
  1642.  
  1643.       Class = t;
  1644.       ExpandChecks(W_40->Attributes);
  1645.       if (W_40->BaseClass->U_1.V_1.Kind == Tree_NoClass) {
  1646.         W_40->Attributes = Tree_mAttribute(W_40->Attributes, iNull, iNull, SET_ELEM(Tree_Synthesized) | SET_ELEM(Tree_Computed) | SET_ELEM(Tree_Dummy), Positions_NoPosition);
  1647.       }
  1648.       return;
  1649.     }
  1650.     break;
  1651.   case Tree_Child:;
  1652.     {
  1653.       register Tree_yChild *W_41 = &t->U_1.V_9.Child;
  1654.  
  1655.       ExpandChecks(W_41->Next);
  1656.       return;
  1657.     }
  1658.     break;
  1659.   case Tree_Attribute:;
  1660.     {
  1661.       register Tree_yAttribute *W_42 = &t->U_1.V_10.Attribute;
  1662.  
  1663.       ExpandChecks(W_42->Next);
  1664.       return;
  1665.     }
  1666.     break;
  1667.   case Tree_ActionPart:;
  1668.     {
  1669.       register Tree_yActionPart *W_43 = &t->U_1.V_11.ActionPart;
  1670.  
  1671.       ExpandChecks(W_43->Actions);
  1672.       ExpandChecks(W_43->Next);
  1673.       return;
  1674.     }
  1675.     break;
  1676.   case Tree_Assign:;
  1677.     {
  1678.       register Tree_yAssign *W_44 = &t->U_1.V_36.Assign;
  1679.  
  1680.       ExpandChecks(W_44->Next);
  1681.       return;
  1682.     }
  1683.     break;
  1684.   case Tree_Copy:;
  1685.     {
  1686.       register Tree_yCopy *W_45 = &t->U_1.V_37.Copy;
  1687.  
  1688.       ExpandChecks(W_45->Next);
  1689.       return;
  1690.     }
  1691.     break;
  1692.   case Tree_TargetCode:;
  1693.     {
  1694.       register Tree_yTargetCode *W_46 = &t->U_1.V_38.TargetCode;
  1695.  
  1696.       ExpandChecks(W_46->Next);
  1697.       return;
  1698.     }
  1699.     break;
  1700.   case Tree_Order:;
  1701.     {
  1702.       register Tree_yOrder *W_47 = &t->U_1.V_39.Order;
  1703.  
  1704.       ExpandChecks(W_47->Next);
  1705.       return;
  1706.     }
  1707.     break;
  1708.   case Tree_Check:;
  1709.     {
  1710.       register Tree_yCheck *W_48 = &t->U_1.V_40.Check;
  1711.  
  1712.       if (W_48->Results == Tree_NoTree) {
  1713.         INC(ChecksCount);
  1714.         Strings_IntToString(ChecksCount, &String);
  1715.         Ident = Idents_MakeIdent(&String);
  1716.         Class->U_1.V_5.Class.Attributes = Tree_mAttribute(Class->U_1.V_5.Class.Attributes, Ident, Ident, SET_ELEM(Tree_Test), Positions_NoPosition);
  1717.         W_48->Results = Tree_mIdent(Ident, Positions_NoPosition, Tree_nNoDesignator);
  1718.       } else {
  1719.         Class->U_1.V_5.Class.Attributes = Tree_mAttribute(Class->U_1.V_5.Class.Attributes, W_48->Results->U_1.V_16.Ident.Attribute, W_48->Results->U_1.V_16.Ident.Attribute, SET_ELEM(Tree_Test), Positions_NoPosition);
  1720.       }
  1721.       ExpandChecks(W_48->Next);
  1722.       return;
  1723.     }
  1724.     break;
  1725.   default :
  1726.     break;
  1727.   }
  1728. }
  1729.  
  1730. static void ExpandMultiple2
  1731. # ifdef __STDC__
  1732. (Tree_tTree t)
  1733. # else
  1734. (t)
  1735. Tree_tTree t;
  1736. # endif
  1737. {
  1738.   struct S_10 yyTempo;
  1739.  
  1740.   if (t == Tree_NoTree) {
  1741.     return;
  1742.   }
  1743.   if (t->U_1.V_1.Kind == Tree_Child) {
  1744.     {
  1745.       register Tree_yChild *W_49 = &t->U_1.V_9.Child;
  1746.  
  1747.       if (!Tree_HasItem(TheClass, W_49->Item)) {
  1748.         Node = Tree_mChild((Tree_tTree)Tree_NoTree, W_49->Name, W_49->Type, W_49->Properties, W_49->Pos);
  1749.         Node->U_1.V_8.AttrOrAction.Item = W_49->Item;
  1750.         AppendAttr(&TheClass->U_1.V_5.Class.Attributes, Node);
  1751.       }
  1752.       return;
  1753.     }
  1754.   }
  1755.   if (t->U_1.V_1.Kind == Tree_Attribute) {
  1756.     {
  1757.       register Tree_yAttribute *W_50 = &t->U_1.V_10.Attribute;
  1758.  
  1759.       if (!Tree_HasItem(TheClass, W_50->Item)) {
  1760.         Node = Tree_mAttribute((Tree_tTree)Tree_NoTree, W_50->Name, W_50->Type, W_50->Properties, W_50->Pos);
  1761.         Node->U_1.V_8.AttrOrAction.Item = W_50->Item;
  1762.         AppendAttr(&TheClass->U_1.V_5.Class.Attributes, Node);
  1763.       }
  1764.       return;
  1765.     }
  1766.   }
  1767.   if (t->U_1.V_1.Kind == Tree_ActionPart) {
  1768.     {
  1769.       register Tree_yActionPart *W_51 = &t->U_1.V_11.ActionPart;
  1770.  
  1771.       if (!Tree_HasItem(TheClass, W_51->Item)) {
  1772.         Node = Tree_mActionPart((Tree_tTree)Tree_NoTree, W_51->Actions);
  1773.         Node->U_1.V_8.AttrOrAction.Item = W_51->Item;
  1774.         INCL(Node->U_1.V_11.ActionPart.Properties, Tree_MultInhComp);
  1775.         AppendAttr(&TheClass->U_1.V_5.Class.Attributes, Node);
  1776.       }
  1777.       return;
  1778.     }
  1779.   }
  1780. }
  1781.  
  1782. static void CountClasses
  1783. # ifdef __STDC__
  1784. (Tree_tTree t)
  1785. # else
  1786. (t)
  1787. Tree_tTree t;
  1788. # endif
  1789. {
  1790.   struct S_11 yyTempo;
  1791.  
  1792.   if (t == Tree_NoTree) {
  1793.     return;
  1794.   }
  1795.   if (t->U_1.V_1.Kind == Tree_Class) {
  1796.     {
  1797.       register Tree_yClass *W_52 = &t->U_1.V_5.Class;
  1798.  
  1799.       if (!IN(Tree_Abstract, W_52->Properties)) {
  1800.         INC(Tree_ClassCount);
  1801.       }
  1802.       ChildCount = 0;
  1803.       AttributeCount = 0;
  1804.       ActionCount = 0;
  1805.       Class = t;
  1806.       Tree_ForallAttributes(t, (Tree_ProcOfT)CountClasses);
  1807.       if (ChildCount > 0) {
  1808.         INCL(t->U_1.V_5.Class.Properties, Tree_HasChildren);
  1809.       }
  1810.       if (AttributeCount > 0) {
  1811.         INCL(t->U_1.V_5.Class.Properties, Tree_HasAttributes);
  1812.       }
  1813.       if (ActionCount > 0) {
  1814.         INCL(t->U_1.V_5.Class.Properties, Tree_HasActions);
  1815.       }
  1816.       if (IN(Tree_Terminal, W_52->Properties) && W_52->Code != 0) {
  1817.         if (Sets_IsElement((LONGCARD)W_52->Code, &CodesUsed)) {
  1818.           Tree_ErrorI((LONGINT)TerminalCodeMultipleUsed, t->U_1.V_5.Class.Pos, (LONGINT)Errors_Integer, ADR(W_52->Code));
  1819.         }
  1820.         Sets_Include(&CodesUsed, (LONGCARD)W_52->Code);
  1821.       }
  1822.       return;
  1823.     }
  1824.   }
  1825.   if (t->U_1.V_1.Kind == Tree_Child) {
  1826.     {
  1827.       register Tree_yChild *W_53 = &t->U_1.V_9.Child;
  1828.  
  1829.       INC(ChildCount);
  1830.       return;
  1831.     }
  1832.   }
  1833.   if (t->U_1.V_1.Kind == Tree_Attribute) {
  1834.     {
  1835.       register Tree_yAttribute *W_54 = &t->U_1.V_10.Attribute;
  1836.  
  1837.       if ((Tree_NoCodeAttr & W_54->Properties) == 0X0L) {
  1838.         Sets_Include(&Tree_TypeNames, (LONGCARD)W_54->Type);
  1839.         if (IN(Tree_Nonterminal, Class->U_1.V_5.Class.Properties) || W_54->Name != Tree_iPosition) {
  1840.           INC(AttributeCount);
  1841.         }
  1842.       }
  1843.       return;
  1844.     }
  1845.   }
  1846.   if (t->U_1.V_1.Kind == Tree_ActionPart) {
  1847.     {
  1848.       register Tree_yActionPart *W_55 = &t->U_1.V_11.ActionPart;
  1849.  
  1850.       INC(ActionCount);
  1851.       return;
  1852.     }
  1853.   }
  1854. }
  1855.  
  1856. static void CompReachable
  1857. # ifdef __STDC__
  1858. (Tree_tTree t)
  1859. # else
  1860. (t)
  1861. Tree_tTree t;
  1862. # endif
  1863. {
  1864.   struct S_12 yyTempo;
  1865.  
  1866.   if (t == Tree_NoTree) {
  1867.     return;
  1868.   }
  1869.   if (t->U_1.V_1.Kind == Tree_Class) {
  1870.     for (;;) {
  1871.       {
  1872.         register Tree_yClass *W_56 = &t->U_1.V_5.Class;
  1873.  
  1874.         if (!!IN(Tree_Reachable, W_56->Properties)) {
  1875.           goto EXIT_1;
  1876.         }
  1877.         INCL(W_56->Properties, Tree_Reachable);
  1878.         Tree_ForallAttributes(W_56->Attributes, (Tree_ProcOfT)CompReachable);
  1879.         Tree_ForallClasses(W_56->Extensions, (Tree_ProcOfT)CompReachable);
  1880.         return;
  1881.       }
  1882.     } EXIT_1:;
  1883.   }
  1884.   if (t->U_1.V_1.Kind == Tree_Child) {
  1885.     {
  1886.       register Tree_yChild *W_57 = &t->U_1.V_9.Child;
  1887.  
  1888.       W_57->Class = Tree_IdentifyClass(Tree_TreeRoot->U_1.V_26.Ag.Classes, W_57->Type);
  1889.       if (W_57->Class != Tree_NoTree) {
  1890.         INCL(W_57->Class->U_1.V_5.Class.Properties, Tree_Referenced);
  1891.         CompReachable(W_57->Class);
  1892.       } else {
  1893.         if (!Sets_IsElement(ORD('j'), &Tree_Options)) {
  1894.           Tree_WarningI((LONGINT)NodeTypeNotDeclared, t->U_1.V_9.Child.Pos, (LONGINT)Errors_Ident, ADR(W_57->Type));
  1895.         }
  1896.         if (Tree_TreeRoot->U_1.V_26.Ag.Classes->U_1.V_1.Kind == Tree_NoClass) {
  1897.           Tree_TreeRoot->U_1.V_26.Ag.Classes = Tree_mClass(W_57->Type, SET_ELEM(Tree_Terminal) | SET_ELEM(Tree_Implicit) | SET_ELEM(Tree_Reachable) | SET_ELEM(Tree_Referenced), Tree_nNoAttribute, Tree_nNoClass, Tree_TreeRoot->U_1.V_26.Ag.Classes, W_57->Type, W_57->Pos, 0, Idents_NoIdent, Tree_nNoName);
  1898.           Tree_InitIdentifyClass2(Tree_TreeRoot->U_1.V_26.Ag.Classes);
  1899.           Tree_TreeRoot->U_1.V_26.Ag.Classes->U_1.V_5.Class.BaseClass = Tree_nNoClass;
  1900.           W_57->Class = Tree_TreeRoot->U_1.V_26.Ag.Classes;
  1901.         } else {
  1902.           Node = Tree_TreeRoot->U_1.V_26.Ag.Classes;
  1903.           while (Node->U_1.V_5.Class.Next->U_1.V_1.Kind != Tree_NoClass) {
  1904.             Node = Node->U_1.V_5.Class.Next;
  1905.           }
  1906.           Node->U_1.V_5.Class.Next = Tree_mClass(W_57->Type, SET_ELEM(Tree_Terminal) | SET_ELEM(Tree_Implicit) | SET_ELEM(Tree_Reachable) | SET_ELEM(Tree_Referenced), Tree_nNoAttribute, Tree_nNoClass, Node->U_1.V_5.Class.Next, W_57->Type, W_57->Pos, 0, Idents_NoIdent, Tree_nNoName);
  1907.           Tree_InitIdentifyClass2(Node->U_1.V_5.Class.Next);
  1908.           Node->U_1.V_5.Class.Next->U_1.V_5.Class.BaseClass = Tree_nNoClass;
  1909.           W_57->Class = Node->U_1.V_5.Class.Next;
  1910.         }
  1911.         INC(Tree_ClassCount);
  1912.       }
  1913.       return;
  1914.     }
  1915.   }
  1916. }
  1917.  
  1918. static void CodeTerminals
  1919. # ifdef __STDC__
  1920. (Tree_tTree t)
  1921. # else
  1922. (t)
  1923. Tree_tTree t;
  1924. # endif
  1925. {
  1926.   struct S_13 yyTempo;
  1927.  
  1928.   if (t == Tree_NoTree) {
  1929.     return;
  1930.   }
  1931.   if (t->U_1.V_1.Kind == Tree_Class) {
  1932.     {
  1933.       register Tree_yClass *W_58 = &t->U_1.V_5.Class;
  1934.  
  1935.       if (SET_IS_SUBSET1(SET_ELEM(Tree_Terminal) | SET_ELEM(Tree_Referenced), W_58->Properties) && W_58->Code == 0) {
  1936.         do {
  1937.           INC(TokenCode);
  1938.         } while (!!Sets_IsElement((LONGCARD)TokenCode, &CodesUsed));
  1939.         W_58->Code = TokenCode;
  1940.       }
  1941.       if (IN(Tree_Terminal, W_58->Properties) && W_58->BaseClass->U_1.V_1.Kind == Tree_NoClass) {
  1942.         W_58->Attributes = Tree_mAttribute(W_58->Attributes, Tree_iPosition, Tree_itPosition, SET_ELEM(Tree_Synthesized) | SET_ELEM(Tree_Computed) | SET_ELEM(Tree_Input) | SET_ELEM(Tree_Read), Positions_NoPosition);
  1943.       }
  1944.       return;
  1945.     }
  1946.   }
  1947. }
  1948.  
  1949. static void CheckReverse
  1950. # ifdef __STDC__
  1951. (Tree_tTree t)
  1952. # else
  1953. (t)
  1954. Tree_tTree t;
  1955. # endif
  1956. {
  1957.   struct S_14 yyTempo;
  1958.  
  1959.   if (t == Tree_NoTree) {
  1960.     return;
  1961.   }
  1962.   if (t->U_1.V_1.Kind == Tree_Class) {
  1963.     {
  1964.       register Tree_yClass *W_59 = &t->U_1.V_5.Class;
  1965.  
  1966.       if (W_59->Extensions->U_1.V_1.Kind == Tree_NoClass) {
  1967.         ReverseCount = 0;
  1968.         Tree_ForallAttributes(t, (Tree_ProcOfT)CheckReverse);
  1969.       }
  1970.       return;
  1971.     }
  1972.   }
  1973.   if (t->U_1.V_1.Kind == Tree_Child) {
  1974.     {
  1975.       register Tree_yChild *W_60 = &t->U_1.V_9.Child;
  1976.  
  1977.       if (IN(Tree_Reverse, W_60->Properties)) {
  1978.         INC(ReverseCount);
  1979.         if (ReverseCount > 1) {
  1980.           Tree_Error((LONGINT)OnlyOneReverseInNodeType, t->U_1.V_9.Child.Pos);
  1981.         }
  1982.       }
  1983.       return;
  1984.     }
  1985.   }
  1986. }
  1987.  
  1988. static void CheckNames
  1989. # ifdef __STDC__
  1990. (Tree_tTree t)
  1991. # else
  1992. (t)
  1993. Tree_tTree t;
  1994. # endif
  1995. {
  1996.   struct S_15 yyTempo;
  1997.  
  1998.   if (t == Tree_NoTree) {
  1999.     return;
  2000.   }
  2001.   switch (t->U_1.V_1.Kind) {
  2002.   case Tree_Class:;
  2003.     {
  2004.       register Tree_yClass *W_61 = &t->U_1.V_5.Class;
  2005.  
  2006.       if (Sets_IsElement((LONGCARD)W_61->Name, &ClassNames)) {
  2007.         Tree_ErrorI((LONGINT)NodeTypeMultipleDeclared, t->U_1.V_5.Class.Pos, (LONGINT)Errors_Ident, ADR(W_61->Name));
  2008.       }
  2009.       Sets_Include(&ClassNames, (LONGCARD)W_61->Name);
  2010.       if (IN(Tree_Terminal, W_61->Properties)) {
  2011.         if (Sets_IsElement((LONGCARD)W_61->Selector, &VariantNames)) {
  2012.           Tree_ErrorI((LONGINT)VariantSelectorMultipleDeclared, t->U_1.V_5.Class.Pos, (LONGINT)Errors_Ident, ADR(W_61->Selector));
  2013.         }
  2014.         Sets_Include(&VariantNames, (LONGCARD)W_61->Selector);
  2015.       }
  2016.       if (W_61->Prec != Idents_NoIdent && !Sets_IsElement((LONGCARD)W_61->Prec, &PrecNames)) {
  2017.         Tree_ErrorI((LONGINT)PrecedenceNotDeclared, t->U_1.V_5.Class.Pos, (LONGINT)Errors_Ident, ADR(W_61->Prec));
  2018.       }
  2019.       if (W_61->Extensions->U_1.V_1.Kind == Tree_NoClass) {
  2020.         Sets_AssignEmpty(&SelectorNames);
  2021.         Tree_ForallAttributes(t, (Tree_ProcOfT)CheckNames);
  2022.       }
  2023.       CheckNames2(W_61->Names);
  2024.       return;
  2025.     }
  2026.     break;
  2027.   case Tree_Child:;
  2028.     {
  2029.       register Tree_yChild *W_62 = &t->U_1.V_9.Child;
  2030.  
  2031.       if (Sets_IsElement((LONGCARD)W_62->Name, &SelectorNames)) {
  2032.         if (!(Sets_IsElement(ORD('x'), &Tree_Options) || Sets_IsElement(ORD('z'), &Tree_Options) || Sets_IsElement(ORD('u'), &Tree_Options))) {
  2033.           Tree_ErrorI((LONGINT)SelectorMultipleDeclared, t->U_1.V_9.Child.Pos, (LONGINT)Errors_Ident, ADR(W_62->Name));
  2034.         }
  2035.       }
  2036.       Sets_Include(&SelectorNames, (LONGCARD)W_62->Name);
  2037.       return;
  2038.     }
  2039.     break;
  2040.   case Tree_Attribute:;
  2041.     {
  2042.       register Tree_yAttribute *W_63 = &t->U_1.V_10.Attribute;
  2043.  
  2044.       if (Sets_IsElement((LONGCARD)W_63->Name, &SelectorNames)) {
  2045.         Tree_ErrorI((LONGINT)SelectorMultipleDeclared, t->U_1.V_10.Attribute.Pos, (LONGINT)Errors_Ident, ADR(W_63->Name));
  2046.       }
  2047.       Sets_Include(&SelectorNames, (LONGCARD)W_63->Name);
  2048.       return;
  2049.     }
  2050.     break;
  2051.   case Tree_LeftAssoc:;
  2052.     {
  2053.       register Tree_yLeftAssoc *W_64 = &t->U_1.V_30.LeftAssoc;
  2054.  
  2055.       CheckNames(W_64->Names);
  2056.       CheckNames(W_64->Next);
  2057.       return;
  2058.     }
  2059.     break;
  2060.   case Tree_RightAssoc:;
  2061.     {
  2062.       register Tree_yRightAssoc *W_65 = &t->U_1.V_31.RightAssoc;
  2063.  
  2064.       CheckNames(W_65->Names);
  2065.       CheckNames(W_65->Next);
  2066.       return;
  2067.     }
  2068.     break;
  2069.   case Tree_NonAssoc:;
  2070.     {
  2071.       register Tree_yNonAssoc *W_66 = &t->U_1.V_32.NonAssoc;
  2072.  
  2073.       CheckNames(W_66->Names);
  2074.       CheckNames(W_66->Next);
  2075.       return;
  2076.     }
  2077.     break;
  2078.   case Tree_Name:;
  2079.     {
  2080.       register Tree_yName *W_67 = &t->U_1.V_25.Name;
  2081.  
  2082.       if (Sets_IsElement((LONGCARD)W_67->Name, &PrecNames)) {
  2083.         Tree_ErrorI((LONGINT)PrecedenceMultipleDeclared, t->U_1.V_25.Name.Pos, (LONGINT)Errors_Ident, ADR(W_67->Name));
  2084.       }
  2085.       Sets_Include(&PrecNames, (LONGCARD)W_67->Name);
  2086.       CheckNames(W_67->Next);
  2087.       return;
  2088.     }
  2089.     break;
  2090.   default :
  2091.     break;
  2092.   }
  2093. }
  2094.  
  2095. static void CheckNames2
  2096. # ifdef __STDC__
  2097. (Tree_tTree t)
  2098. # else
  2099. (t)
  2100. Tree_tTree t;
  2101. # endif
  2102. {
  2103.   struct S_16 yyTempo;
  2104.  
  2105.   if (t == Tree_NoTree) {
  2106.     return;
  2107.   }
  2108.   if (t->U_1.V_1.Kind == Tree_Name) {
  2109.     {
  2110.       register Tree_yName *W_68 = &t->U_1.V_25.Name;
  2111.  
  2112.       Class = Tree_IdentifyClass(Tree_TreeRoot->U_1.V_26.Ag.Classes, W_68->Name);
  2113.       if (Class == Tree_NoTree) {
  2114.         Tree_ErrorI((LONGINT)NodeTypeNotDeclared, t->U_1.V_25.Name.Pos, (LONGINT)Errors_Ident, ADR(W_68->Name));
  2115.       } else {
  2116.         if (!IN(Tree_Abstract, Class->U_1.V_5.Class.Properties)) {
  2117.           Tree_Error((LONGINT)AbstractTypeRequired, t->U_1.V_25.Name.Pos);
  2118.         }
  2119.       }
  2120.       CheckNames2(W_68->Next);
  2121.       return;
  2122.     }
  2123.   }
  2124. }
  2125.  
  2126. static void CheckDesignator
  2127. # ifdef __STDC__
  2128. (Tree_tTree t)
  2129. # else
  2130. (t)
  2131. Tree_tTree t;
  2132. # endif
  2133. {
  2134.   struct S_17 yyTempo;
  2135.  
  2136.   if (t == Tree_NoTree) {
  2137.     return;
  2138.   }
  2139.   switch (t->U_1.V_1.Kind) {
  2140.   case Tree_Class:;
  2141.     {
  2142.       register Tree_yClass *W_69 = &t->U_1.V_5.Class;
  2143.  
  2144.       Class = t;
  2145.       Tree_ForallAttributes(W_69->Attributes, (Tree_ProcOfT)CheckDesignator);
  2146.       return;
  2147.     }
  2148.     break;
  2149.   case Tree_ActionPart:;
  2150.     {
  2151.       register Tree_yActionPart *W_70 = &t->U_1.V_11.ActionPart;
  2152.  
  2153.       CheckDesignator(W_70->Actions);
  2154.       return;
  2155.     }
  2156.     break;
  2157.   case Tree_Assign:;
  2158.     {
  2159.       register Tree_yAssign *W_71 = &t->U_1.V_36.Assign;
  2160.  
  2161.       CheckDesignator(W_71->Results);
  2162.       CheckDesignator(W_71->Arguments);
  2163.       CheckDesignator(W_71->Next);
  2164.       return;
  2165.     }
  2166.     break;
  2167.   case Tree_Copy:;
  2168.     {
  2169.       register Tree_yCopy *W_72 = &t->U_1.V_37.Copy;
  2170.  
  2171.       CheckDesignator(W_72->Results);
  2172.       CheckDesignator(W_72->Arguments);
  2173.       CheckDesignator(W_72->Next);
  2174.       return;
  2175.     }
  2176.     break;
  2177.   case Tree_TargetCode:;
  2178.     {
  2179.       register Tree_yTargetCode *W_73 = &t->U_1.V_38.TargetCode;
  2180.  
  2181.       CheckDesignator(W_73->Code);
  2182.       CheckDesignator(W_73->Next);
  2183.       return;
  2184.     }
  2185.     break;
  2186.   case Tree_Check:;
  2187.     {
  2188.       register Tree_yCheck *W_74 = &t->U_1.V_40.Check;
  2189.  
  2190.       CheckDesignator(W_74->Statement);
  2191.       CheckDesignator(W_74->Condition);
  2192.       CheckDesignator(W_74->Actions);
  2193.       CheckDesignator(W_74->Next);
  2194.       return;
  2195.     }
  2196.     break;
  2197.   case Tree_Designator:;
  2198.     {
  2199.       register Tree_yDesignator *W_75 = &t->U_1.V_15.Designator;
  2200.  
  2201.       Node = Tree_IdentifyAttribute(Class, W_75->Selector);
  2202.       if (Node != Tree_NoTree) {
  2203.         if (Node->U_1.V_1.Kind != Tree_Child) {
  2204.           Tree_Error((LONGINT)ChildRequired, t->U_1.V_15.Designator.Pos);
  2205.         } else {
  2206.           if (Node->U_1.V_9.Child.Class != Tree_NoTree) {
  2207.             Node = Tree_IdentifyAttribute(Node->U_1.V_9.Child.Class, W_75->Attribute);
  2208.             if (Node == Tree_NoTree) {
  2209.               Tree_ErrorI((LONGINT)AttributeNotDeclared, t->U_1.V_15.Designator.Pos, (LONGINT)Errors_Ident, ADR(W_75->Attribute));
  2210.             }
  2211.           }
  2212.         }
  2213.       } else {
  2214.         Tree_ErrorI((LONGINT)SelectorNotDeclared, t->U_1.V_15.Designator.Pos, (LONGINT)Errors_Ident, ADR(W_75->Selector));
  2215.       }
  2216.       CheckDesignator(W_75->Next);
  2217.       return;
  2218.     }
  2219.     break;
  2220.   case Tree_Remote:;
  2221.     {
  2222.       register Tree_yRemote *W_76 = &t->U_1.V_17.Remote;
  2223.  
  2224.       Node = Tree_IdentifyClass(Tree_TreeRoot->U_1.V_26.Ag.Classes, W_76->Type);
  2225.       if (Node == Tree_NoTree) {
  2226.         Tree_ErrorI((LONGINT)NodeTypeNotDeclared, t->U_1.V_17.Remote.Pos, (LONGINT)Errors_Ident, ADR(W_76->Type));
  2227.       } else {
  2228.         Node = Tree_IdentifyAttribute(Node, W_76->Attribute);
  2229.         if (Node == Tree_NoTree) {
  2230.           Tree_ErrorI((LONGINT)AttributeNotDeclared, t->U_1.V_17.Remote.Pos, (LONGINT)Errors_Ident, ADR(W_76->Attribute));
  2231.         }
  2232.       }
  2233.       CheckDesignator(W_76->Designators);
  2234.       CheckDesignator(W_76->Next);
  2235.       return;
  2236.     }
  2237.     break;
  2238.   case Tree_Order:;
  2239.     {
  2240.       register Tree_yOrder *W_77 = &t->U_1.V_39.Order;
  2241.  
  2242.       CheckDesignator(W_77->Next);
  2243.       return;
  2244.     }
  2245.     break;
  2246.   case Tree_Ident:;
  2247.     {
  2248.       register Tree_yIdent *W_78 = &t->U_1.V_16.Ident;
  2249.  
  2250.       CheckDesignator(W_78->Next);
  2251.       return;
  2252.     }
  2253.     break;
  2254.   case Tree_Any:;
  2255.     {
  2256.       register Tree_yAny *W_79 = &t->U_1.V_18.Any;
  2257.  
  2258.       CheckDesignator(W_79->Next);
  2259.       return;
  2260.     }
  2261.     break;
  2262.   case Tree_Anys:;
  2263.     {
  2264.       register Tree_yAnys *W_80 = &t->U_1.V_19.Anys;
  2265.  
  2266.       CheckDesignator(W_80->Next);
  2267.       return;
  2268.     }
  2269.     break;
  2270.   case Tree_LayoutAny:;
  2271.     {
  2272.       register Tree_yLayoutAny *W_81 = &t->U_1.V_22.LayoutAny;
  2273.  
  2274.       CheckDesignator(W_81->Next);
  2275.       return;
  2276.     }
  2277.     break;
  2278.   default :
  2279.     break;
  2280.   }
  2281. }
  2282.  
  2283. static void Identify
  2284. # ifdef __STDC__
  2285. (Tree_tTree t)
  2286. # else
  2287. (t)
  2288. Tree_tTree t;
  2289. # endif
  2290. {
  2291.   struct S_18 yyTempo;
  2292.  
  2293.   if (t == Tree_NoTree) {
  2294.     return;
  2295.   }
  2296.   if (t->U_1.V_1.Kind == Tree_Class) {
  2297.     {
  2298.       register Tree_yClass *W_82 = &t->U_1.V_5.Class;
  2299.  
  2300.       Tree_ForallAttributes(t, (Tree_ProcOfT)Identify);
  2301.       return;
  2302.     }
  2303.   }
  2304.   if (t->U_1.V_1.Kind == Tree_Child) {
  2305.     {
  2306.       register Tree_yChild *W_83 = &t->U_1.V_9.Child;
  2307.  
  2308.       W_83->Class = Tree_IdentifyClass(Tree_TreeRoot->U_1.V_26.Ag.Classes, W_83->Type);
  2309.       if (W_83->Class == Tree_NoTree && !Sets_IsElement(ORD('x'), &Tree_Options) && !Sets_IsElement(ORD('z'), &Tree_Options) && !Sets_IsElement(ORD('u'), &Tree_Options)) {
  2310.         Tree_ErrorI((LONGINT)NodeTypeNotDeclared, t->U_1.V_9.Child.Pos, (LONGINT)Errors_Ident, ADR(W_83->Type));
  2311.       }
  2312.       return;
  2313.     }
  2314.   }
  2315. }
  2316.  
  2317. static void InitInstance0
  2318. # ifdef __STDC__
  2319. (Tree_tTree t)
  2320. # else
  2321. (t)
  2322. Tree_tTree t;
  2323. # endif
  2324. {
  2325.   struct S_19 yyTempo;
  2326.  
  2327.   if (t == Tree_NoTree) {
  2328.     return;
  2329.   }
  2330.   if (t->U_1.V_1.Kind == Tree_Class) {
  2331.     {
  2332.       register Tree_yClass *W_84 = &t->U_1.V_5.Class;
  2333.  
  2334.       InstanceSize = W_84->InstCount;
  2335.       DynArray_MakeArray((ADDRESS *)&W_84->Instance, &InstanceSize, (LONGINT)sizeof(Tree_tInstance));
  2336.       InitInstance(t, W_84->AttrCount, W_84->Instance);
  2337.       return;
  2338.     }
  2339.   }
  2340. }
  2341.  
  2342. static void CompDP
  2343. # ifdef __STDC__
  2344. (Tree_tTree t)
  2345. # else
  2346. (t)
  2347. Tree_tTree t;
  2348. # endif
  2349. {
  2350.   struct S_20 yyTempo;
  2351.  
  2352.   if (t == Tree_NoTree) {
  2353.     return;
  2354.   }
  2355.   if (t->U_1.V_1.Kind == Tree_Class) {
  2356.     {
  2357.       register Tree_yClass *W_85 = &t->U_1.V_5.Class;
  2358.  
  2359.       Relations_MakeRelation(&W_85->DP, (LONGINT)W_85->InstCount, (LONGINT)W_85->InstCount);
  2360.       relation = W_85->DP;
  2361.       Sets_MakeSet(&Results, (LONGCARD)W_85->InstCount);
  2362.       Sets_MakeSet(&Arguments, (LONGCARD)W_85->InstCount);
  2363.       Class = t;
  2364.       Attribute = Tree_IdentifyAttribute(t, iNull);
  2365.       DummyIndex = Attribute->U_1.V_10.Attribute.AttrIndex;
  2366.       INCL(W_85->Instance->A[DummyIndex - 1].Properties, Tree_Left);
  2367.       CompDP1(t, &Results, (LONGINT)Tree_Write, TRUE, TRUE);
  2368.       Sets_ReleaseSet(&Results);
  2369.       Sets_ReleaseSet(&Arguments);
  2370.       return;
  2371.     }
  2372.   }
  2373. }
  2374.  
  2375. static void CopyProperties
  2376. # ifdef __STDC__
  2377. (Tree_tTree t)
  2378. # else
  2379. (t)
  2380. Tree_tTree t;
  2381. # endif
  2382. {
  2383.   struct S_21 yyTempo;
  2384.  
  2385.   if (t == Tree_NoTree) {
  2386.     return;
  2387.   }
  2388.   if (t->U_1.V_1.Kind == Tree_Class) {
  2389.     {
  2390.       register Tree_yClass *W_86 = &t->U_1.V_5.Class;
  2391.  
  2392.       {
  2393.         SHORTCARD B_5 = 1, B_6 = W_86->InstCount;
  2394.  
  2395.         if (B_5 <= B_6)
  2396.           for (i = B_5;; i += 1) {
  2397.             {
  2398.               register Tree_tInstance *W_87 = &W_86->Instance->A[i - 1];
  2399.  
  2400.               W_87->Properties = W_87->Properties | W_87->Attribute->U_1.V_9.Child.Properties;
  2401.               if (W_87->Action != ADR(W_87->Action) && W_87->Action->U_1.V_1.Kind == Tree_Copy) {
  2402.                 INCL(W_87->Properties, Tree_CopyDef);
  2403.                 INCL(W_86->Instance->A[W_87->CopyArg - 1].Properties, Tree_CopyUse);
  2404.               }
  2405.               if (Sets_IsElement(ORD('2'), &Tree_Options)) {
  2406.                 if (!IN(Tree_NonBaseComp, W_87->Properties) && W_87->Action != ADR(W_87->Action) && (SET_IS_SUBSET1(SET_ELEM(Tree_Synthesized) | SET_ELEM(Tree_Left), W_87->Properties) || SET_IS_SUBSET1(SET_ELEM(Tree_Inherited) | SET_ELEM(Tree_Right), W_87->Properties))) {
  2407.                   Idents_WriteIdent((System_tFile)IO_StdOutput, W_86->Name);
  2408.                   IO_WriteS((System_tFile)IO_StdOutput, (STRING)"    = { ", 5L);
  2409.                   Tree_WriteClass(W_87->Action);
  2410.                   IO_WriteS((System_tFile)IO_StdOutput, (STRING)" } .", 4L);
  2411.                   IO_WriteNl((System_tFile)IO_StdOutput);
  2412.                 }
  2413.               }
  2414.             }
  2415.             if (i >= B_6) break;
  2416.           }
  2417.       }
  2418.       return;
  2419.     }
  2420.   }
  2421. }
  2422.  
  2423. static void CheckUsage
  2424. # ifdef __STDC__
  2425. (Tree_tTree t)
  2426. # else
  2427. (t)
  2428. Tree_tTree t;
  2429. # endif
  2430. {
  2431.   struct S_22 yyTempo;
  2432.  
  2433.   if (t == Tree_NoTree) {
  2434.     return;
  2435.   }
  2436.   if (t->U_1.V_1.Kind == Tree_Class) {
  2437.     {
  2438.       register Tree_yClass *W_88 = &t->U_1.V_5.Class;
  2439.  
  2440.       if (W_88->Extensions->U_1.V_1.Kind == Tree_NoClass) {
  2441.         Class = t;
  2442.         IsAbstract = IN(Tree_Abstract, W_88->Properties);
  2443.         Tree_ForallAttributes(t, (Tree_ProcOfT)CheckUsage);
  2444.       }
  2445.       return;
  2446.     }
  2447.   }
  2448.   if (t->U_1.V_1.Kind == Tree_Child) {
  2449.     {
  2450.       register Tree_yChild *W_89 = &t->U_1.V_9.Child;
  2451.  
  2452.       if (!Sets_IsElement(ORD('W'), &Tree_Options) && !IsAbstract) {
  2453.         if (!IN(Tree_Input, W_89->Properties) && !IN(Tree_Write, W_89->Properties)) {
  2454.           Tree_WarningI((LONGINT)AttributeNeverSet, t->U_1.V_9.Child.Pos, (LONGINT)Errors_Ident, ADR(W_89->Name));
  2455.         }
  2456.         if (!IN(Tree_Output, W_89->Properties) && !IN(Tree_Read, W_89->Properties) && !Sets_IsElement(ORD('x'), &Tree_Options) && !Sets_IsElement(ORD('z'), &Tree_Options) && !Sets_IsElement(ORD('u'), &Tree_Options)) {
  2457.           Tree_WarningI((LONGINT)AttributeNeverUsed, t->U_1.V_9.Child.Pos, (LONGINT)Errors_Ident, ADR(W_89->Name));
  2458.         }
  2459.       }
  2460.       if (SET_IS_SUBSET1(SET_ELEM(Tree_Input) | SET_ELEM(Tree_Write), W_89->Properties) && (W_89->Class == Tree_NoTree || W_89->Class != Tree_NoTree && !IN(Tree_Terminal, W_89->Class->U_1.V_5.Class.Properties))) {
  2461.         Tree_ErrorI((LONGINT)InputAttributeIsSet, t->U_1.V_9.Child.Pos, (LONGINT)Errors_Ident, ADR(W_89->Name));
  2462.       }
  2463.       if (SET_IS_SUBSET1(SET_ELEM(Tree_Synthesized) | SET_ELEM(Tree_Inherited), W_89->Properties)) {
  2464.         Tree_ErrorI((LONGINT)AttributeSynthesizedAsWellAsInherited, t->U_1.V_9.Child.Pos, (LONGINT)Errors_Ident, ADR(W_89->Name));
  2465.       }
  2466.       return;
  2467.     }
  2468.   }
  2469.   if (t->U_1.V_1.Kind == Tree_Attribute) {
  2470.     for (;;) {
  2471.       {
  2472.         register Tree_yAttribute *W_90 = &t->U_1.V_10.Attribute;
  2473.  
  2474.         if (!(((SET_ELEM(Tree_Test) | SET_ELEM(Tree_Dummy)) & W_90->Properties) == 0X0L)) {
  2475.           goto EXIT_2;
  2476.         }
  2477.         if (!Sets_IsElement(ORD('W'), &Tree_Options) && !IsAbstract) {
  2478.           if (!IN(Tree_Input, W_90->Properties) && !IN(Tree_Write, W_90->Properties)) {
  2479.             Tree_WarningI((LONGINT)AttributeNeverSet, t->U_1.V_10.Attribute.Pos, (LONGINT)Errors_Ident, ADR(W_90->Name));
  2480.           }
  2481.           if (!IN(Tree_Output, W_90->Properties) && !IN(Tree_Read, W_90->Properties)) {
  2482.             Tree_WarningI((LONGINT)AttributeNeverUsed, t->U_1.V_10.Attribute.Pos, (LONGINT)Errors_Ident, ADR(W_90->Name));
  2483.           }
  2484.         }
  2485.         if (SET_IS_SUBSET1(SET_ELEM(Tree_Input) | SET_ELEM(Tree_Write), W_90->Properties) && (Class == Tree_NoTree || Class != Tree_NoTree && !IN(Tree_Terminal, Class->U_1.V_5.Class.Properties))) {
  2486.           Tree_ErrorI((LONGINT)InputAttributeIsSet, t->U_1.V_10.Attribute.Pos, (LONGINT)Errors_Ident, ADR(W_90->Name));
  2487.         }
  2488.         if (SET_IS_SUBSET1(SET_ELEM(Tree_Synthesized) | SET_ELEM(Tree_Inherited), W_90->Properties)) {
  2489.           Tree_ErrorI((LONGINT)AttributeSynthesizedAsWellAsInherited, t->U_1.V_10.Attribute.Pos, (LONGINT)Errors_Ident, ADR(W_90->Name));
  2490.         }
  2491.         return;
  2492.       }
  2493.     } EXIT_2:;
  2494.   }
  2495. }
  2496.  
  2497. static void CheckUsage2
  2498. # ifdef __STDC__
  2499. (Tree_tTree t)
  2500. # else
  2501. (t)
  2502. Tree_tTree t;
  2503. # endif
  2504. {
  2505.   struct S_23 yyTempo;
  2506.  
  2507.   if (t == Tree_NoTree) {
  2508.     return;
  2509.   }
  2510.   if (t->U_1.V_1.Kind == Tree_Class) {
  2511.     {
  2512.       register struct S_24 *W_91 = &yyTempo.U_1.V_1.yyR1;
  2513.  
  2514.       for (;;) {
  2515.         {
  2516.           register Tree_yClass *W_92 = &t->U_1.V_5.Class;
  2517.  
  2518.           if (!!Sets_IsElement(ORD('W'), &Tree_Options)) {
  2519.             goto EXIT_3;
  2520.           }
  2521.           if (!!IN(Tree_Reachable, W_92->Properties)) {
  2522.             goto EXIT_3;
  2523.           }
  2524.           Idents_GetString(W_92->Name, &W_91->String);
  2525.           if (!(Strings_Char(&W_91->String, 1) != 'y' && Strings_Char(&W_91->String, 2) != 'y')) {
  2526.             goto EXIT_3;
  2527.           }
  2528.           Tree_WarningI((LONGINT)NodeTypeNotUsed, t->U_1.V_5.Class.Pos, (LONGINT)Errors_Ident, ADR(W_92->Name));
  2529.           return;
  2530.         }
  2531.       } EXIT_3:;
  2532.     }
  2533.   }
  2534. }
  2535.  
  2536. static void CheckInherited
  2537. # ifdef __STDC__
  2538. (Tree_tTree t)
  2539. # else
  2540. (t)
  2541. Tree_tTree t;
  2542. # endif
  2543. {
  2544.   struct S_25 yyTempo;
  2545.  
  2546.   if (t == Tree_NoTree) {
  2547.     return;
  2548.   }
  2549.   if (t->U_1.V_1.Kind == Tree_Class) {
  2550.     {
  2551.       register Tree_yClass *W_93 = &t->U_1.V_5.Class;
  2552.  
  2553.       if (W_93->BaseClass->U_1.V_1.Kind == Tree_Class) {
  2554.         CheckInherited(W_93->Attributes);
  2555.       }
  2556.       return;
  2557.     }
  2558.   }
  2559.   if (t->U_1.V_1.Kind == Tree_Child) {
  2560.     {
  2561.       register Tree_yChild *W_94 = &t->U_1.V_9.Child;
  2562.  
  2563.       if (IN(Tree_Inherited, W_94->Properties)) {
  2564.         Tree_ErrorI((LONGINT)InheritedAttributesOnlyInBaseClasses, t->U_1.V_9.Child.Pos, (LONGINT)Errors_Ident, ADR(W_94->Name));
  2565.       }
  2566.       CheckInherited(W_94->Next);
  2567.       return;
  2568.     }
  2569.   }
  2570.   if (t->U_1.V_1.Kind == Tree_Attribute) {
  2571.     {
  2572.       register Tree_yAttribute *W_95 = &t->U_1.V_10.Attribute;
  2573.  
  2574.       if (IN(Tree_Inherited, W_95->Properties)) {
  2575.         Tree_ErrorI((LONGINT)InheritedAttributesOnlyInBaseClasses, t->U_1.V_10.Attribute.Pos, (LONGINT)Errors_Ident, ADR(W_95->Name));
  2576.       }
  2577.       CheckInherited(W_95->Next);
  2578.       return;
  2579.     }
  2580.   }
  2581. }
  2582.  
  2583. static void CheckComplete
  2584. # ifdef __STDC__
  2585. (Tree_tTree t)
  2586. # else
  2587. (t)
  2588. Tree_tTree t;
  2589. # endif
  2590. {
  2591.   struct S_26 yyTempo;
  2592.  
  2593.   if (t == Tree_NoTree) {
  2594.     return;
  2595.   }
  2596.   if (t->U_1.V_1.Kind == Tree_Class) {
  2597.     {
  2598.       register Tree_yClass *W_96 = &t->U_1.V_5.Class;
  2599.  
  2600.       if (W_96->Extensions->U_1.V_1.Kind == Tree_NoClass || !Sets_IsElement(ORD('B'), &Tree_Options)) {
  2601.         {
  2602.           SHORTCARD B_7 = 1, B_8 = W_96->InstCount;
  2603.  
  2604.           if (B_7 <= B_8)
  2605.             for (i = B_7;; i += 1) {
  2606.               {
  2607.                 register Tree_tInstance *W_97 = &W_96->Instance->A[i - 1];
  2608.  
  2609.                 if (!IN(Tree_Computed, W_97->Properties) && (IN(Tree_Terminal, t->U_1.V_5.Class.Properties) && W_97->Attribute->U_1.V_1.Kind == Tree_Attribute || SET_IS_SUBSET1(SET_ELEM(Tree_Synthesized) | SET_ELEM(Tree_Left), W_97->Properties) || SET_IS_SUBSET1(SET_ELEM(Tree_Inherited) | SET_ELEM(Tree_Right), W_97->Properties))) {
  2610.                   CopyRule(t);
  2611.                   if (j == 0) {
  2612.                     Idents_GetString(W_96->Name, &String);
  2613.                     Strings_ArrayToString((STRING)" = ", 3L, &String2);
  2614.                     Strings_Concatenate(&String, &String2);
  2615.                     if (IN(Tree_Right, W_97->Properties)) {
  2616.                       Idents_GetString(W_97->Selector->U_1.V_9.Child.Name, &String2);
  2617.                       Strings_Concatenate(&String, &String2);
  2618.                       Strings_Append(&String, ':');
  2619.                       Idents_GetString(W_97->Attribute->U_1.V_9.Child.Name, &String2);
  2620.                       Strings_Concatenate(&String, &String2);
  2621.                     } else {
  2622.                       Idents_GetString(W_97->Attribute->U_1.V_9.Child.Name, &String2);
  2623.                       Strings_Concatenate(&String, &String2);
  2624.                     }
  2625.                     Tree_ErrorI((LONGINT)AttributeComputationMissing, t->U_1.V_5.Class.Pos, (LONGINT)Errors_String, ADR(String));
  2626.                   }
  2627.                 }
  2628.               }
  2629.               if (i >= B_8) break;
  2630.             }
  2631.         }
  2632.       }
  2633.       if (Sets_IsElement(ORD('L'), &Tree_Options)) {
  2634.         {
  2635.           SHORTCARD B_9 = 1, B_10 = W_96->AttrCount;
  2636.  
  2637.           if (B_9 <= B_10)
  2638.             for (i = B_9;; i += 1) {
  2639.               {
  2640.                 register Tree_tInstance *W_98 = &W_96->Instance->A[i - 1];
  2641.  
  2642.                 if (!IN(Tree_Input, W_98->Properties) && W_98->Attribute->U_1.V_1.Kind == Tree_Child) {
  2643.                   {
  2644.                     SHORTCARD B_11 = 1, B_12 = W_96->InstCount;
  2645.  
  2646.                     if (B_11 <= B_12)
  2647.                       for (j = B_11;; j += 1) {
  2648.                         if (Relations_IsRelated((LONGINT)j, (LONGINT)i, W_96->DP)) {
  2649.                           {
  2650.                             SHORTCARD B_13 = 1, B_14 = W_96->AttrCount;
  2651.  
  2652.                             if (B_13 <= B_14)
  2653.                               for (k = B_13;; k += 1) {
  2654.                                 if (Relations_IsRelated((LONGINT)k, (LONGINT)j, W_96->DP)) {
  2655.                                   Relations_Include(&W_96->DP, (LONGINT)k, (LONGINT)i);
  2656.                                 }
  2657.                                 if (k >= B_14) break;
  2658.                               }
  2659.                           }
  2660.                         }
  2661.                         if (j >= B_12) break;
  2662.                       }
  2663.                   }
  2664.                 }
  2665.               }
  2666.               if (i >= B_10) break;
  2667.             }
  2668.         }
  2669.       }
  2670.       if (Relations_IsCyclic(W_96->DP)) {
  2671.         Tree_ErrorI((LONGINT)CycleInLocalDependenciesDP, t->U_1.V_5.Class.Pos, (LONGINT)Errors_Ident, ADR(W_96->Name));
  2672.         IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Attribute Dependencies DP", 25L);
  2673.         IO_WriteNl((System_tFile)IO_StdOutput);
  2674.         IO_WriteNl((System_tFile)IO_StdOutput);
  2675.         Tree_WriteDependencies(t, W_96->DP, Tree_MaxSet);
  2676.         IO_WriteS((System_tFile)IO_StdOutput, (STRING)"Cyclic Attributes", 17L);
  2677.         IO_WriteNl((System_tFile)IO_StdOutput);
  2678.         IO_WriteNl((System_tFile)IO_StdOutput);
  2679.         Sets_MakeSet(&Cyclics, (LONGCARD)W_96->InstCount);
  2680.         Relations_GetCyclics(W_96->DP, &Cyclics);
  2681.         Tree_WriteCyclics(t, Cyclics);
  2682.         IO_WriteNl((System_tFile)IO_StdOutput);
  2683.         Sets_ReleaseSet(&Cyclics);
  2684.         Success = FALSE;
  2685.       }
  2686.       if (Sets_IsElement(ORD('M'), &Tree_Options)) {
  2687.         Tree_WriteClass(t);
  2688.         IO_WriteNl((System_tFile)IO_StdOutput);
  2689.       }
  2690.       if (Sets_IsElement(ORD('P'), &Tree_Options)) {
  2691.         Tree_WriteDependencies(t, W_96->DP, Tree_MaxSet);
  2692.       }
  2693.       return;
  2694.     }
  2695.   }
  2696. }
  2697.  
  2698. static void CopyRule
  2699. # ifdef __STDC__
  2700. (Tree_tTree t)
  2701. # else
  2702. (t)
  2703. Tree_tTree t;
  2704. # endif
  2705. {
  2706.   struct S_27 yyTempo;
  2707.  
  2708.   if (t == Tree_NoTree) {
  2709.     return;
  2710.   }
  2711.   if (t->U_1.V_1.Kind == Tree_Class) {
  2712.     {
  2713.       register Tree_yClass *W_99 = &t->U_1.V_5.Class;
  2714.  
  2715.       {
  2716.         register Tree_tInstance *W_100 = &W_99->Instance->A[i - 1];
  2717.  
  2718.         j = 0;
  2719.         if (i <= W_99->AttrCount) {
  2720.           Ident = W_100->Attribute->U_1.V_10.Attribute.Name;
  2721.           Tree_ForallAttributes(t, (Tree_ProcOfT)CopyRule2);
  2722.           if (j != 0) {
  2723.             INC1(j, W_99->AttrCount + Child->U_1.V_9.Child.InstOffset);
  2724.             W_100->Action = Tree_mCopy(Tree_nNoAction, Positions_NoPosition, Tree_mIdent(Ident, Positions_NoPosition, Tree_nNoDesignator), Tree_mDesignator(W_99->Instance->A[j - 1].Selector->U_1.V_9.Child.Name, Ident, Positions_NoPosition, Tree_nNoDesignator));
  2725.             INC(CopySynthesized);
  2726.           }
  2727.           if (j == 0 && IN(Tree_Thread, W_100->Properties)) {
  2728.             j = i - 1;
  2729.             W_100->Action = Tree_mCopy(Tree_nNoAction, Positions_NoPosition, Tree_mIdent(Ident, Positions_NoPosition, Tree_nNoDesignator), Tree_mIdent(W_99->Instance->A[j - 1].Attribute->U_1.V_10.Attribute.Name, Positions_NoPosition, Tree_nNoDesignator));
  2730.             INC(CopyThreaded);
  2731.           }
  2732.         } else {
  2733.           if (IN(Tree_Thread, W_100->Properties) && W_100->Selector->U_1.V_9.Child.InstOffset > 0) {
  2734.             Ident = W_99->Instance->A[i + 1 - 1].Attribute->U_1.V_10.Attribute.Name;
  2735.             j = i - 1;
  2736.             for (;;) {
  2737.               if (j <= W_99->AttrCount) {
  2738.                 j = 0;
  2739.                 goto EXIT_4;
  2740.               }
  2741.               if (W_99->Instance->A[j - 1].Attribute->U_1.V_10.Attribute.Name == Ident) {
  2742.                 W_100->Action = Tree_mCopy(Tree_nNoAction, Positions_NoPosition, Tree_mDesignator(W_100->Selector->U_1.V_9.Child.Name, W_100->Attribute->U_1.V_10.Attribute.Name, Positions_NoPosition, Tree_nNoDesignator), Tree_mDesignator(W_99->Instance->A[j - 1].Selector->U_1.V_9.Child.Name, Ident, Positions_NoPosition, Tree_nNoDesignator));
  2743.                 INC(CopyThreaded);
  2744.                 goto EXIT_4;
  2745.               }
  2746.               DEC(j);
  2747.             } EXIT_4:;
  2748.           }
  2749.           if (j == 0) {
  2750.             Ident = W_100->Attribute->U_1.V_10.Attribute.Name;
  2751.             Tree_ForallAttributes(t, (Tree_ProcOfT)CopyRule);
  2752.             if (j != 0) {
  2753.               W_100->Action = Tree_mCopy(Tree_nNoAction, Positions_NoPosition, Tree_mDesignator(W_100->Selector->U_1.V_9.Child.Name, Ident, Positions_NoPosition, Tree_nNoDesignator), Tree_mIdent(Ident, Positions_NoPosition, Tree_nNoDesignator));
  2754.               INC(CopyInherited);
  2755.             }
  2756.           }
  2757.         }
  2758.         if (j != 0) {
  2759.           if (Sets_IsElement(ORD('1'), &Tree_Options)) {
  2760.             Idents_WriteIdent((System_tFile)IO_StdOutput, W_99->Name);
  2761.             IO_WriteS((System_tFile)IO_StdOutput, (STRING)"    = { ", 5L);
  2762.             Tree_WriteClass(W_100->Action);
  2763.             IO_WriteS((System_tFile)IO_StdOutput, (STRING)" } .", 4L);
  2764.             IO_WriteNl((System_tFile)IO_StdOutput);
  2765.           }
  2766.           W_100->CopyArg = j;
  2767.           TheAction = W_100->Action;
  2768.           Relations_Include(&W_99->DP, (LONGINT)i, (LONGINT)j);
  2769.           INCL(W_100->Properties, Tree_CopyDef);
  2770.           INCL(W_99->Instance->A[W_100->CopyArg - 1].Properties, Tree_CopyUse);
  2771.           INCL(W_100->Properties, Tree_Write);
  2772.           INCL(W_100->Properties, Tree_Computed);
  2773.           INCL(W_99->Instance->A[W_100->CopyArg - 1].Properties, Tree_Read);
  2774.           INCL(W_100->Attribute->U_1.V_10.Attribute.Properties, Tree_Write);
  2775.           INCL(W_100->Attribute->U_1.V_10.Attribute.Properties, Tree_Computed);
  2776.           INCL(W_99->Instance->A[W_100->CopyArg - 1].Attribute->U_1.V_10.Attribute.Properties, Tree_Read);
  2777.           if (IN(Tree_Right, W_100->Properties)) {
  2778.             INCL(W_100->Selector->U_1.V_9.Child.Properties, Tree_Read);
  2779.           }
  2780.           if (IN(Tree_Right, W_99->Instance->A[W_100->CopyArg - 1].Properties)) {
  2781.             INCL(W_99->Instance->A[W_100->CopyArg - 1].Selector->U_1.V_9.Child.Properties, Tree_Read);
  2782.           }
  2783.         }
  2784.       }
  2785.       if (j != 0) {
  2786.         INCL(W_99->Properties, Tree_HasActions);
  2787.         if (W_99->Attributes->U_1.V_1.Kind == Tree_NoAttribute) {
  2788.           W_99->Attributes = Tree_mActionPart(W_99->Attributes, TheAction);
  2789.         } else {
  2790.           Node = W_99->Attributes;
  2791.           while (Node->U_1.V_8.AttrOrAction.Next->U_1.V_1.Kind != Tree_NoAttribute) {
  2792.             Node = Node->U_1.V_8.AttrOrAction.Next;
  2793.           }
  2794.           if (Node->U_1.V_1.Kind == Tree_ActionPart) {
  2795.             TheAction->U_1.V_35.Action.Next = Node->U_1.V_11.ActionPart.Actions;
  2796.             Node->U_1.V_11.ActionPart.Actions = TheAction;
  2797.           } else {
  2798.             Node->U_1.V_8.AttrOrAction.Next = Tree_mActionPart(Tree_nNoAttribute, TheAction);
  2799.           }
  2800.         }
  2801.       }
  2802.       return;
  2803.     }
  2804.   }
  2805.   if (t->U_1.V_1.Kind == Tree_Child) {
  2806.     {
  2807.       register Tree_yChild *W_101 = &t->U_1.V_9.Child;
  2808.  
  2809.       if (W_101->Name == Ident) {
  2810.         Child = Attribute;
  2811.         j = W_101->AttrIndex;
  2812.       }
  2813.       return;
  2814.     }
  2815.   }
  2816.   if (t->U_1.V_1.Kind == Tree_Attribute) {
  2817.     {
  2818.       register Tree_yAttribute *W_102 = &t->U_1.V_10.Attribute;
  2819.  
  2820.       if (W_102->Name == Ident) {
  2821.         Child = Attribute;
  2822.         j = W_102->AttrIndex;
  2823.       }
  2824.       return;
  2825.     }
  2826.   }
  2827. }
  2828.  
  2829. static void CopyRule2
  2830. # ifdef __STDC__
  2831. (Tree_tTree t)
  2832. # else
  2833. (t)
  2834. Tree_tTree t;
  2835. # endif
  2836. {
  2837.   struct S_28 yyTempo;
  2838.  
  2839.   if (t == Tree_NoTree) {
  2840.     return;
  2841.   }
  2842.   if (t->U_1.V_1.Kind == Tree_Child) {
  2843.     for (;;) {
  2844.       {
  2845.         register Tree_yChild *W_103 = &t->U_1.V_9.Child;
  2846.  
  2847.         if (!(W_103->Class != Tree_NoTree)) {
  2848.           goto EXIT_5;
  2849.         }
  2850.         Attribute = t;
  2851.         Tree_ForallAttributes(W_103->Class, (Tree_ProcOfT)CopyRule);
  2852.         return;
  2853.       }
  2854.     } EXIT_5:;
  2855.   }
  2856. }
  2857.  
  2858. static BOOLEAN IsCopy
  2859. # ifdef __STDC__
  2860. (Tree_tTree yyP1)
  2861. # else
  2862. (yyP1)
  2863. Tree_tTree yyP1;
  2864. # endif
  2865. {
  2866.   struct S_29 yyTempo;
  2867.  
  2868.   if (yyP1 == Tree_NoTree) {
  2869.     return FALSE;
  2870.   }
  2871.   if (yyP1->U_1.V_1.Kind == Tree_Designator) {
  2872.     {
  2873.       register struct S_30 *W_104 = &yyTempo.U_1.V_1.yyR1;
  2874.  
  2875.       for (;;) {
  2876.         {
  2877.           register Tree_yDesignator *W_105 = &yyP1->U_1.V_15.Designator;
  2878.  
  2879.           W_104->Attr = Tree_IdentifyAttribute(Class, W_105->Selector);
  2880.           if (!(W_104->Attr != Tree_NoTree)) {
  2881.             goto EXIT_6;
  2882.           }
  2883.           if (!(W_104->Attr->U_1.V_1.Kind == Tree_Child)) {
  2884.             goto EXIT_6;
  2885.           }
  2886.           W_104->ChildsClass = W_104->Attr->U_1.V_9.Child.Class;
  2887.           if (!(W_104->ChildsClass != Tree_NoTree)) {
  2888.             goto EXIT_6;
  2889.           }
  2890.           if (!(Tree_IdentifyAttribute(W_104->ChildsClass, W_105->Attribute) != Tree_NoTree)) {
  2891.             goto EXIT_6;
  2892.           }
  2893.           if (!IsWhiteSpace(W_105->Next)) {
  2894.             goto EXIT_6;
  2895.           }
  2896.           return TRUE;
  2897.         }
  2898.       } EXIT_6:;
  2899.     }
  2900.   }
  2901.   if (yyP1->U_1.V_1.Kind == Tree_Ident) {
  2902.     for (;;) {
  2903.       {
  2904.         register Tree_yIdent *W_106 = &yyP1->U_1.V_16.Ident;
  2905.  
  2906.         if (!(Tree_IdentifyAttribute(Class, W_106->Attribute) != Tree_NoTree)) {
  2907.           goto EXIT_7;
  2908.         }
  2909.         if (!IsWhiteSpace(W_106->Next)) {
  2910.           goto EXIT_7;
  2911.         }
  2912.         return TRUE;
  2913.       }
  2914.     } EXIT_7:;
  2915.   }
  2916.   if (yyP1->U_1.V_1.Kind == Tree_Any) {
  2917.     for (;;) {
  2918.       {
  2919.         register Tree_yAny *W_107 = &yyP1->U_1.V_18.Any;
  2920.  
  2921.         if (!IsWhiteSpace2(W_107->Code)) {
  2922.           goto EXIT_8;
  2923.         }
  2924.         if (!IsCopy(W_107->Next)) {
  2925.           goto EXIT_8;
  2926.         }
  2927.         return TRUE;
  2928.       }
  2929.     } EXIT_8:;
  2930.   }
  2931.   if (yyP1->U_1.V_1.Kind == Tree_Anys) {
  2932.     for (;;) {
  2933.       {
  2934.         register Tree_yAnys *W_108 = &yyP1->U_1.V_19.Anys;
  2935.  
  2936.         if (!IsCopy(W_108->Next)) {
  2937.           goto EXIT_9;
  2938.         }
  2939.         return TRUE;
  2940.       }
  2941.     } EXIT_9:;
  2942.   }
  2943.   return FALSE;
  2944. }
  2945.  
  2946. static BOOLEAN IsWhiteSpace
  2947. # ifdef __STDC__
  2948. (Tree_tTree yyP2)
  2949. # else
  2950. (yyP2)
  2951. Tree_tTree yyP2;
  2952. # endif
  2953. {
  2954.   struct S_31 yyTempo;
  2955.  
  2956.   if (yyP2 == Tree_NoTree) {
  2957.     return FALSE;
  2958.   }
  2959.   if (yyP2->U_1.V_1.Kind == Tree_Any) {
  2960.     for (;;) {
  2961.       {
  2962.         register Tree_yAny *W_109 = &yyP2->U_1.V_18.Any;
  2963.  
  2964.         if (!IsWhiteSpace2(W_109->Code)) {
  2965.           goto EXIT_10;
  2966.         }
  2967.         if (!IsWhiteSpace(W_109->Next)) {
  2968.           goto EXIT_10;
  2969.         }
  2970.         return TRUE;
  2971.       }
  2972.     } EXIT_10:;
  2973.   }
  2974.   if (yyP2->U_1.V_1.Kind == Tree_Anys) {
  2975.     for (;;) {
  2976.       {
  2977.         register Tree_yAnys *W_110 = &yyP2->U_1.V_19.Anys;
  2978.  
  2979.         if (!IsWhiteSpace(W_110->Next)) {
  2980.           goto EXIT_11;
  2981.         }
  2982.         return TRUE;
  2983.       }
  2984.     } EXIT_11:;
  2985.   }
  2986.   if (yyP2->U_1.V_1.Kind == Tree_NoDesignator) {
  2987.     return TRUE;
  2988.   }
  2989.   return FALSE;
  2990. }
  2991.  
  2992. static BOOLEAN IsWhiteSpace2
  2993. # ifdef __STDC__
  2994. (StringMem_tStringRef yyP3)
  2995. # else
  2996. (yyP3)
  2997. StringMem_tStringRef yyP3;
  2998. # endif
  2999. {
  3000.   CARDINAL i;
  3001.   struct S_32 yyTempo;
  3002.  
  3003.   {
  3004.     register struct S_33 *W_111 = &yyTempo.U_1.V_1.yyR1;
  3005.  
  3006.     StringMem_GetString(yyP3, &W_111->String);
  3007.     {
  3008.       LONGCARD B_15 = 1, B_16 = Strings_Length(&W_111->String);
  3009.  
  3010.       if (B_15 <= B_16)
  3011.         for (i = B_15;; i += 1) {
  3012.           W_111->ch = Strings_Char(&W_111->String, (Strings_tStringIndex)i);
  3013.           if (W_111->ch != ' ' && W_111->ch != '\n' && W_111->ch != '\t') {
  3014.             return FALSE;
  3015.           }
  3016.           if (i >= B_16) break;
  3017.         }
  3018.     }
  3019.     return TRUE;
  3020.   }
  3021. }
  3022.  
  3023. void Semantics_BeginSemantics
  3024. # ifdef __STDC__
  3025. ()
  3026. # else
  3027. ()
  3028. # endif
  3029. {
  3030.   ItemCount = 0;
  3031.   ChecksCount = 0;
  3032.   MaxInstCount = 0;
  3033.   CopyInherited = 0;
  3034.   CopySynthesized = 0;
  3035.   CopyThreaded = 0;
  3036.   Strings_IntToString(0L, &String);
  3037.   iNull = Idents_MakeIdent(&String);
  3038. }
  3039.  
  3040. void Semantics_CloseSemantics
  3041. # ifdef __STDC__
  3042. ()
  3043. # else
  3044. ()
  3045. # endif
  3046. {
  3047. }
  3048.  
  3049. static void yyExit
  3050. # ifdef __STDC__
  3051. ()
  3052. # else
  3053. ()
  3054. # endif
  3055. {
  3056.   IO_CloseIO();
  3057.   Exit(1L);
  3058. }
  3059.  
  3060. void BEGIN_Semantics()
  3061. {
  3062.   static BOOLEAN has_been_called = FALSE;
  3063.  
  3064.   if (!has_been_called) {
  3065.     has_been_called = TRUE;
  3066.  
  3067.     BEGIN_IO();
  3068.     BEGIN_Tree();
  3069.     BEGIN_System();
  3070.     BEGIN_IO();
  3071.     BEGIN_Tree();
  3072.     BEGIN_General();
  3073.     BEGIN_IO();
  3074.     BEGIN_DynArray();
  3075.     BEGIN_StringMem();
  3076.     BEGIN_Strings();
  3077.     BEGIN_Idents();
  3078.     BEGIN_Texts();
  3079.     BEGIN_Sets();
  3080.     BEGIN_Relations();
  3081.     BEGIN_Positions();
  3082.     BEGIN_Tree();
  3083.     BEGIN_Relations();
  3084.     BEGIN_StringMem();
  3085.     BEGIN_Errors();
  3086.  
  3087.     Semantics_yyf = IO_StdOutput;
  3088.     Semantics_Exit = yyExit;
  3089.     Semantics_BeginSemantics();
  3090.   }
  3091. }
  3092.